Skip to content

lsdev14/karma-ng-i18n-preprocessor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

karma-ng-i18n-preprocessor

Preprocessor to use any valid i18n config from JADE file to AngularJS templates.

Build Status

Installation

Installation is simple using the following:

npm install karma-ng-i18n-preprocessor --save-dev

Configuration

// karma.conf.js
module.exports = function(config) {
  config.set({
    
    files: [
            'content/shared/views/**/*.jade'
    ],
    
    preprocessors: {
            'content/shared/views/**/*.jade': 'ng-i18n'
    },
    
    ngi18nPreprocessor: {
            i18n : {
                "directory" : "./test/mocks/content"
            }
    }
  });
};

Example

Locales file
// en.json
{
    "lblTest": "Hello"
}
Before
span(id="lblTest") #{__("lblTest")}
After
span(id="lblTest") Hello

You can use other preprocessors together with ng-stripScript

npm install karma-ng-jade2js-preprocessor --save-dev
npm install karma-ng-stripscript-preprocessor --save-dev
// karma.conf.js
preprocessors: {
       'content/shared/views/**/*.jade': ['ng-i18n','ng-jade2js','ng-stripScript']
}

For more information on Karma see the homepage.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published