├── .editorconfig
├── .gitattributes
├── .gitignore
├── .jshintrc
├── .travis.yml
├── README.md
├── bin
└── ng-html2js
├── package.json
├── spec
├── ng-html2js_spec.js
├── support
│ └── jasmine.json
├── test.tmpl
└── testOutputs
│ ├── expectedTestTmplJs
│ ├── expectedTestTmplJsStrippedPrefix
│ ├── expectedTestTmplJsWithModule
│ ├── expectedTestTmplJsWithModuleAndModuleVar
│ ├── expectedTestTmplJsWithModuleVar
│ ├── expectedTestTmplJsWithoutBaseDir
│ └── expectedTestTmplOutputFileJs
└── src
├── html2js.js
├── singleModule.tmpl
└── template.tmpl
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig helps developers define and maintain consistent
2 | # coding styles between different editors and IDEs
3 | # editorconfig.org
4 |
5 | root = true
6 |
7 | [*]
8 | indent_style = space
9 | indent_size = 2
10 | end_of_line = lf
11 | charset = utf-8
12 | trim_trailing_whitespace = true
13 | insert_final_newline = true
14 |
15 | [*.md]
16 | trim_trailing_whitespace = false
17 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules/
2 | /spec/testOutputFile
3 |
--------------------------------------------------------------------------------
/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "node": true,
3 | "browser": true,
4 | "esnext": true,
5 | "bitwise": true,
6 | "camelcase": true,
7 | "curly": true,
8 | "eqeqeq": true,
9 | "immed": true,
10 | "indent": 2,
11 | "latedef": true,
12 | "newcap": true,
13 | "noarg": true,
14 | "quotmark": "single",
15 | "regexp": true,
16 | "undef": true,
17 | "unused": true,
18 | "strict": true,
19 | "trailing": true,
20 | "smarttabs": true
21 | }
22 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 | language: node_js
3 | node_js:
4 | - "0.12"
5 | - "0.10"
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ng-html2js [](https://github.com/yaru22/ng-html2js)
2 | ==========
3 | [](http://travis-ci.org/yaru22/ng-html2js)
4 | [](https://gemnasium.com/yaru22/ng-html2js)
5 |
6 | Standalone script to turn Angular template into js and put it in a module.
7 |
8 |
9 | Usage
10 | -----
11 | ```
12 | $ ng-html2js inputFile [outputFile] [-m moduleName] [--module-var ngModule]
13 | ```
14 |
15 | If you specify only inputFile, it will display the result to the console.
16 |
17 | If you don't specify moduleName, inputFile will be the name of the module.
18 | ```
19 | $ ng-html2js test/test.tmpl
20 | var module = angular.module('test/test.tmpl', []);
21 | module.run(['$templateCache', function($templateCache) {
22 | $templateCache.put('test/test.tmpl',
23 | '
\n' +
24 | ' hello world\n' +
25 | '
\n' +
26 | ' {{ item }} it\'s value is great\n' +
27 | '
\n' +
28 | '
\n' +
29 | '');
30 | }]);
31 | ```
32 |
33 | If you specify moduleName, the template will belong to that module.
34 | ```
35 | $ ng-html2js test/test.tmpl -m foo --module-var ngModule
36 | var ngModule;
37 | try {
38 | ngModule = angular.module('foo');
39 | } catch (e) {
40 | ngModule = angular.module('foo', []);
41 | }
42 |
43 | ngModule.run(['$templateCache', function ($templateCache) {
44 | $templateCache.put('test/test.tmpl',
45 | '\n' +
46 | ' hello world\n' +
47 | '
\n' +
48 | ' {{ item }} it\'s value is great\n' +
49 | '
\n' +
50 | '
\n' +
51 | '');
52 | }]);
53 | ```
54 |
55 |
56 | License
57 | -------
58 | This seed is released under permissive MIT License.
59 |
--------------------------------------------------------------------------------
/bin/ng-html2js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | var fs = require('fs');
4 | var optimist = require('optimist');
5 | var path = require('path');
6 | var html2js = require('../src/html2js');
7 |
8 | //
9 | // Setup usage and parse arguments
10 | //
11 |
12 | var argv = optimist.usage('Usage: $0