Last active
August 29, 2015 14:12
-
-
Save asizer/382407c9150930c62e89 to your computer and use it in GitHub Desktop.
Use grunt concat to create single file for dojo modules AND TEMPLATES!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
concat: { | |
options: { | |
banner: 'require({\ncache: {\n', | |
process: function(src, filepath) { | |
var returnStr = '// Source: ' + filepath + '\n'; | |
if (filepath.indexOf('.js') > 0) { | |
// add file name | |
returnStr += '\'' + filepath.replace('js/', '').replace('.js', '') + '\': '; | |
// add function and file text | |
returnStr += 'function() {\n' + src + '}'; | |
} else if (filepath.indexOf('.html') > 0) { | |
// add file name as url | |
returnStr += '\'url:' + filepath.replace('js/', '') + '\': '; | |
// add html template, stripping out newlines and tabs | |
returnStr += '\'' + src.replace(/\n\s*/g, '') + '\''; | |
} else { | |
console.log('uh oh! ' + filepath + ' fell through'); | |
return; | |
} | |
return returnStr; | |
}, | |
footer: '\n}});', | |
separator: ',' + grunt.util.linefeed | |
}, | |
dev: { | |
files: { | |
'js/compiled.js': [ | |
'js/app/**/*.js', | |
'js/widgets/**/*.js', | |
'js/**/*.html' | |
] | |
} | |
} | |
}, | |
uglify: { | |
dist: { | |
files: { | |
'release/js/compiled.min.js': ['release/js/compiled.js'] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment