Skip to content

Commit

Permalink
Implemented --startSymbol and --endSymbol options to allow custom bui…
Browse files Browse the repository at this point in the history
…lds of SmartTable that use different angular interpolation symbols.

Example usage: grunt build --startSymbol="{[{" --endSymbol="}]}"
  • Loading branch information
ccapndave committed May 31, 2013
1 parent e9b5753 commit 8f89930
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
25 changes: 24 additions & 1 deletion GruntFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ module.exports = function (grunt) {
dest: './<%= pkg.name %>.debug.js'
}
},
"regex-replace": {
dist: {
src: ['<%= pkg.name %>.debug.js'],
actions: [
{
search: '\{\{',
replace: "<%= grunt.option('startSymbol') %>",
flags: "g"
},
{
search: '\}\}',
replace: "<%= grunt.option('endSymbol') %>",
flags: "g"
}
]
}
},
html2js: {
options: {
base: 'smart-table-module',
Expand Down Expand Up @@ -45,6 +62,12 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-html2js');
grunt.loadNpmTasks('grunt-regex-replace');
grunt.registerTask('refApp', ['html2js:smartTable', 'concat', 'copy:refApp']);
grunt.registerTask('build', ['html2js:smartTable', 'concat', 'uglify']);
grunt.registerTask('build', function() {
grunt.task.run('html2js:smartTable');
grunt.task.run('concat');
if (grunt.option('startSymbol') && grunt.option('endSymbol')) grunt.task.run('regex-replace');
grunt.task.run('uglify');
});
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"grunt-contrib-clean": "~0.4.1",
"grunt-html2js": "~0.1.3",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-uglify": "~0.2.1"
"grunt-contrib-uglify": "~0.2.1",
"grunt-regex-replace": "~0.2.5"
}
}

0 comments on commit 8f89930

Please sign in to comment.