Permalink
Browse files

added postfix 'templates' added

  • Loading branch information...
1 parent 67fd621 commit 8401b985014f4320c48fd31ba2bec26ad75d8457 @GulinSS committed Aug 12, 2013
Showing with 18 additions and 15 deletions.
  1. +2 −1 lib/index.js
  2. +1 −1 package.json
  3. +3 −1 src/index.coffee
  4. +12 −12 test/JadeAngularJsCompiler.coffee
View
3 lib/index.js
@@ -120,7 +120,7 @@
var findedPath, node, path;
path = this.removeFileNameFromPath(pair.path);
if (assetsTree.length === 0) {
- pair.module = path[0];
+ pair.module = "" + path[0] + ".templates";
return;
}
findedPath = [];
@@ -136,6 +136,7 @@
findedPath.push(child.name);
return node = child.children;
});
+ findedPath.push("templates");
return pair.module = findedPath.join('.');
};
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "jade-angularjs-brunch",
- "version": "1.1.0",
+ "version": "1.1.1",
"description": "Adds Jade support to brunch with angularjs template cache modules.",
"author": {
"name": "Gulin Serge",
View
4 src/index.coffee
@@ -79,7 +79,7 @@ module.exports = class JadeAngularJsCompiler
path = @removeFileNameFromPath pair.path
if assetsTree.length is 0
- pair.module = path[0]
+ pair.module ="#{path[0]}.templates"
return
findedPath = []
@@ -91,6 +91,8 @@ module.exports = class JadeAngularJsCompiler
findedPath.push child.name
node = child.children
+ findedPath.push "templates"
+
pair.module = findedPath.join '.'
removeFileNameFromPath: (path) -> path[0..-2]
View
24 test/JadeAngularJsCompiler.coffee
@@ -195,7 +195,7 @@ describe "JadeAngularJsCompiler", ->
plugin.attachModuleNameToTemplate pair, assetsTree
pair.should.contain.keys ['module']
- pair.module.should.equal "app"
+ pair.module.should.equal "app.templates"
it "Pair should be placed in child module in a case when a folder with index.jade has child folder with own index.jade", ->
pair =
@@ -205,7 +205,7 @@ describe "JadeAngularJsCompiler", ->
plugin.attachModuleNameToTemplate pair, assetsTree
pair.should.contain.keys ['module']
- pair.module.should.equal "app.folder"
+ pair.module.should.equal "app.folder.templates"
it "Pair in deeper path of the last folder with index.jade should be placed in last parent", ->
pair =
@@ -215,7 +215,7 @@ describe "JadeAngularJsCompiler", ->
plugin.attachModuleNameToTemplate pair, assetsTree
pair.should.contain.keys ['module']
- pair.module.should.equal "app.folder"
+ pair.module.should.equal "app.folder.templates"
it "If application don't have any static assets all jade files will be stored in top module", ->
pair =
@@ -225,7 +225,7 @@ describe "JadeAngularJsCompiler", ->
plugin.attachModuleNameToTemplate pair, []
pair.should.contain.keys ['module']
- pair.module.should.equal "app"
+ pair.module.should.equal "app.templates"
describe "generateModuleFileName", ->
it "Generate module file name for writting", ->
@@ -284,29 +284,29 @@ describe "JadeAngularJsCompiler", ->
it "For modules it should filtered and grouped them correct", ->
expect = [
- name: 'test.folder'
+ name: 'test.folder.templates'
templates: [
path: 'test/folder/partial1.jade'
result: '<!DOCTYPE html>'
- module: 'test.folder'
+ module: 'test.folder.templates'
,
path: 'test/folder/partial2.jade'
result: '<!DOCTYPE html>'
- module: 'test.folder'
+ module: 'test.folder.templates'
]
- filename: '_public/js/test.folder.js'
+ filename: '_public/js/test.folder.templates.js'
,
- name: 'test.folder.folder',
+ name: 'test.folder.folder.templates',
templates: [
path: 'test/folder/folder/partial1.jade'
result: '<!DOCTYPE html>'
- module: 'test.folder.folder'
+ module: 'test.folder.folder.templates'
,
path: 'test/folder/folder/partial2.jade'
result: '<!DOCTYPE html>'
- module: 'test.folder.folder'
+ module: 'test.folder.folder.templates'
],
- filename: '_public/js/test.folder.folder.js'
+ filename: '_public/js/test.folder.folder.templates.js'
]
plugin.onCompile data

0 comments on commit 8401b98

Please sign in to comment.