0.1.7 • Published 10 years ago

grunt-baio-globalize-html v0.1.7

Weekly downloads
2
License
-
Repository
github
Last release
10 years ago

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>
0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago