grunt-baio-globalize-html

0.1.7 • Public • Published

Globalize HTML files.

Globalize html files using hadlebars templates and resources, stored in .json files

Installation

  • install Grunt
  • inspall plugin
        npm install grunt-baio-globalize-html --save-dev
  • configure (see example bellow)

Grunt Options

{
    'globalize-html' : {
        build : {
            srcDir : 'source directory',
            resDir : 'resources directory',
            destDir : 'destination directory'
        }
    }
}
  • source directory - directory with template html files
  • resource directory - directory with resource files (in json format)
  • dest directory - directory where globalized files placed

Example

Project Structure

    +
    |
    +---+views
        |
        +---+src
        |   |
        |   +---index.html
        |
        +---+res
            |
            +---en-EN.json

index.html (handlebars template)

    <body>
        <h1>{{MAIN_TITLE}}</h1>
    </body>

en-EN.json (string resources)

    {
        "MAIN_TITLE" : "Hello world"
    }

Grunt config

 
  grunt.initConfig({
      'globalize-html': {
        build: {
          resDir : "views/res",
          srcDir : "views/src",
          destDir : "views"
          }
        }
      });
 
  grunt.loadNpmTasks('grunt-baio-globalize-html');
 
  grunt.registerTask('default', ['globalize-html']);

Run

    grunt

Output

Globalized files will be placed in directory views/en-EN Full path to the output directory composed from destDir path and name of the resource file (in case of the example en-EN)

Globalized file

    <body>
        <h1>Hello world</h1>
    </body>

Readme

Keywords

none

Package Sidebar

Install

npm i grunt-baio-globalize-html

Weekly Downloads

1

Version

0.1.7

License

none

Last publish

Collaborators

  • baio