gruntjs - How to get output from usemin task? -
i'm using usemin task concat , uglify tasks. however, i'm not getting output concat/uglify tasks. not seeing errors or warnings. how can resulting output dist/app/myscript.js script?
gruntfile.js follows:
module.exports = function(grunt){ var paths = { app: 'app', dist: 'dist' }; grunt.initconfig({ paths: paths, clean: { dist: { src: ['<%= paths.dist %>'] } }, copy: { dist: { files: [ {expand: true, cwd: '.', src: ['**'], dest: '<%= paths.dist %>/'} ] } }, useminprepare: { html: '<%= paths.dist %>/<%= paths.app %>/index.html' }, usemin: { html: '<%= paths.dist %>/<%= paths.app %>/index.html' } }); grunt.loadnpmtasks('grunt-usemin'); grunt.loadnpmtasks('grunt-contrib-cssmin'); grunt.loadnpmtasks('grunt-contrib-copy'); grunt.loadnpmtasks('grunt-contrib-clean'); grunt.loadnpmtasks('grunt-contrib-uglify'); grunt.registertask('default', ['clean','copy']); grunt.registertask('use', ['useminprepare','usemin']) }
html build snippet:
<!-- build:js myscript.js --> <script type="text/javascript" src='router.js'></script> <script type="text/javascript" src='bootstrap.js'></script> <!-- endbuild -->
console output:
running "useminprepare:html" (useminprepare) task going through dist/app/index.html update config looking build script html comment blocks found block: <!-- build:js myscript.js --> <!-- globals --> <script type="text/javascript" src='router.js'></script> <script type="text/javascript" src='bootstrap.js'></script> <!-- endbuild --> updating config following assets: - dist/app/router.js - dist/app/bootstrap.js configuration now: cssmin: {} concat: { 'dist/app/myscript.js': [ 'dist/app/router.js', 'dist/app/bootstrap.js' ] } uglify: { 'dist/app/myscript.js': 'dist/app/myscript.js' } requirejs: {} running "usemin:html" (usemin) task processing html - dist/app/index.html update html reference our concat/min/revved script files update html new css filenames update html new img filenames update html data-main tags update html data tags update html background imgs, case there inline style update html anchors images update html reference in input done, without errors.
it turns out problem registertask(). need explicitly add concat/uglify. should this: grunt.registertask('use', ['useminprepare','usemin','concat','uglify'])
Comments
Post a Comment