GulinSS / jade-angularjs-brunch

Automatic compiler Jade templates to AngularJS modules for Brunch.IO
31 stars 21 forks source link

fix virtual path gen #14

Closed vendethiel closed 11 years ago

vendethiel commented 11 years ago

resolve #11

vendethiel commented 11 years ago

Basically with this change, if your template is

src/blog/templates/articles/index.jade

instead of slicing some bits and then adding only the last part, I'm slicing some bits and adding everything after @modulesFolder (and removing it). The virtual path will then be :

blog/articles/index.html

which seems the best to me.

vendethiel commented 11 years ago

@GulinSS could you consider generating only one templates.js file ? I created jade-angularjs-brunch2 for that but I'd rather not duplicate efforts and just have one package for that. I can probably PR if yes.

GulinSS commented 11 years ago

I think that the best solution would be to generate one javascript file for many jade files per folder. Example:

.../templates/1.jade
.../templates/2.jade

.../templates/folder1/1-1.jade
.../templates/folder1/1-2.jade

.../templates/folder1/folder1-1/1-1-1.jade
.../templates/folder1/folder1-1/1-1-2.jade

.../templates/folder1/folder1-2/1-2-1.jade

.../templates/folder2/2-1.jade

Result:

/js/templates.js (contains jade files 1 and 2 with angular module 'templates')
/js/templates.folder1.js (contains jade files 1-1 and 1-2 with angular module 'templates.folder1')
/js/templates.folder1.folder1-1.js (contains jade files 1-1-1 and 1-1-2 with angular module 'templates.folder1.folder1-1')
/js/templates.folder1.folder1-2.js (contains jade file 1-2-1 with angular module 'templates.folder1.folder1-2')
/js/templates.folder2.js (contains jade file 2-1 with angular module 'templates.folder2')
etc...

If our ideas are similar, please start PR.

vendethiel commented 11 years ago

Why do you want separate files?

GulinSS commented 11 years ago

Separating files is very useful if your static html application consisits of SPA-parts. In this case with separated template files you can upload to client templates only needed by current SPA-section of large static javascipt/html application.

Example:

/section1/index.html
/section2/index.html

In section 1 we attach only templates.section1.js file, but in section 2 we attach only templates.section2.js. It is very usefull for large static client-side applications when your client's Internet channel is limited and loading time of pages is important.

vendethiel commented 11 years ago

I see, that makes sense. I'd still like to be able to choose.

GulinSS commented 11 years ago

It seems to has two modes:

And your PR will implements first. So, please select and keep a place to implement second mode.

vendethiel commented 11 years ago

Oke. What should the option name be?

GulinSS commented 11 years ago

May be, hierarchy with boolean type?

vendethiel commented 11 years ago

That doesn't seem very descriptive. Maybe just "single_file"?

GulinSS commented 11 years ago

Okay. Sorry for waiting.