Skip to content

Commit

Permalink
Fix templates compilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucassus committed Jan 6, 2013
1 parent fef1d75 commit 7162e23
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ Gemfile.lock
*.gem *.gem


# ignore compiled templates # ignore compiled templates
app/assets/javascripts/templates/*.js app/assets/javascripts/templates
14 changes: 7 additions & 7 deletions grunt.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module.exports = function(grunt) {
grunt.initConfig({ grunt.initConfig({
watch: { watch: {
templates: { templates: {
files: 'app/assets/templates/*.html', files: "public/ng/templates/**/*.html",
tasks: 'html2js:directives' tasks: "html2js:directives"
} }
}, },


html2js: { html2js: {
directives: ['app/assets/templates/*.html'] directives: ["public/ng/templates/**/*.html"]
} }
}); });


Expand All @@ -19,14 +19,14 @@ module.exports = function(grunt) {
return content.replace(/"/g, '\\"').replace(/\n/g, '" +\n "'); return content.replace(/"/g, '\\"').replace(/\n/g, '" +\n "');
}; };


grunt.registerMultiTask('html2js', 'Generate js version of html template.', function() { grunt.registerMultiTask("html2js", "Generate js version of html template.", function() {
var files = grunt._watch_changed_files || grunt.file.expand(this.data); var files = grunt._watch_changed_files || grunt.file.expand(this.data);


files.forEach(function(file) { files.forEach(function(file) {
var parts = file.split("/"); var parts = file.split("/").slice(3);
var name = parts[parts.length - 1]; var name = parts.join("/");


grunt.file.write("app/assets/javascripts/templates/" + name + '.js', grunt.template.process(TPL, { grunt.file.write("app/assets/javascripts/templates/" + name + ".js", grunt.template.process(TPL, {
file: file, file: file,
path: "/ng/templates/" + file.split("/").pop(), path: "/ng/templates/" + file.split("/").pop(),
content: escapeContent(grunt.file.read(file)) content: escapeContent(grunt.file.read(file))
Expand Down
2 changes: 1 addition & 1 deletion spec/javascripts/app/modules/alerts_spec.js.coffee
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe "mb.alerts", ->
$scope = null $scope = null
element = null element = null


beforeEach module("app/assets/templates/alerts.html") beforeEach module("public/ng/templates/alerts.html")


beforeEach inject ($rootScope, $compile) -> beforeEach inject ($rootScope, $compile) ->
$scope = $rootScope $scope = $rootScope
Expand Down
2 changes: 1 addition & 1 deletion spec/javascripts/app/modules/table_filter_spec.js.coffee
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe "mb.tableFilter", ->
$scope = null $scope = null
element = null element = null


beforeEach module("app/assets/templates/table_filter.html") beforeEach module("public/ng/templates/table_filter.html")


beforeEach inject ($rootScope, $compile) -> beforeEach inject ($rootScope, $compile) ->
$scope = $rootScope $scope = $rootScope
Expand Down

0 comments on commit 7162e23

Please sign in to comment.