I have an express application in which I use bower to manage external dependencies. I also use grunt to create an external interface by combining, extinguishing, minimizing, and modifying all assets, including the scripts / styles that come with each bower component, using grunt-usemin .
To do this, I move all compiled assets (including scripts / styles) to the dist/public directory. I get the <cache-buster>.vendor.js and <cache-buster>.vendor.css that contain all the optimized bower components.
The question is, how do I manage the images that come with the various column packages? I could manually transfer them to my images folder, but I would prefer to leave them packaged in bower_components (where they belong, in my opinion), and leave it to a grunt during the build process.
Any input would be appreciated.
Gruntfile.js (extract)
rev: { dist: { files: [{ src: [ 'dist/public/css/{,*/}*.css', 'dist/public/js/{,*/}*.js', 'dist/public/img/{,*/}*.{gif,jpeg,jpg,png}' ] }] } }, useminPrepare: { options: { dest: 'dist/public' }, jade: ['dist/views/{,*/}*.jade'] }, usemin: { jade: ['dist/views/{,*/}*.jade'], options: { assetsDirs: ['dist/public'], patterns: { jade: require('usemin-patterns').jade } } }, concurrent: { server: [ 'stylus', 'coffee' ], dist: [ 'stylus', 'coffee' ] }, copy: { dist: { files: [{ expand: true, cwd: 'views', dest: 'dist/views', src: '{,*/}*.jade' }] } } }); grunt.registerTask('server', [ 'clean:server', 'concurrent:server', 'express:server', 'watch' ]); grunt.registerTask('build', [ 'clean:dist', 'concurrent:dist', 'copy:dist', 'useminPrepare', 'concat', 'uglify', 'cssmin', 'rev', 'usemin' ]);
layout.jade (extract)
//- link(href='/bower_components/nivo-slider/nivo-slider.css') //- //- link(href='/css/one.css') link(href='/css/two.css') //- //- script(type='text/javascript', src='/bower_components/jquery/jquery.js') script(type='text/javascript', src='/bower_components/nivo-slider/jquery.nivo.slider.js') //- //- script(type='text/javascript', src='/js/one.js') script(type='text/javascript', src='/js/two.js') //-