Friday 15 July 2011

javascript - Grunt - plugin folder disapper after build dist -



javascript - Grunt - plugin folder disapper after build dist -

i'm new yeoman, grunt , bower , of course of study have problem when building distribution.

i used yeoman scaffold webapp, built code, added external plugin (not through bower, there no bundle plugin, copied plugin folder , added references in index.html)

when running grunt serve works fine, first time built distribution with

grunt

i had lot of jshint errors external plugin (missing semicolons etc...small things), had run

grunt --force

to have dist built.

in dist folder, external plugin folder , files missing, in build process folder removed (but index.html file had references files).

so with

grunt serve:dist

i had dist on browser, without plugin. @ point copied plugin folder in right spot of dist folder, reloaded page, , plugin working. killed process, , run again

grunt serve:dist

after command, plugin folder (that manually copied) disappeared, realize re-create , paste not right way create things working.

how can tell grunt (or bower) leave folder (inside js folder) in same spot, not seek compress files inside, ignore js validation jshint, , not remove it?

what if want add together new folder (called illustration jsons) in root folder? when building distribution removed too? there spot can tell grunt folder include/ignore?

thanks

---- edit ----

this "copy" task in gruntfile.js

copy: { dist: { files: [{ expand: true, dot: true, cwd: '<%= config.app %>', dest: '<%= config.dist %>', src: [ '*.{ico,png,txt}', 'images/{,*/}*.webp', '{,*/}*.html', 'styles/fonts/{,*/}*.*' ] }, { src: 'node_modules/apache-server-configs/dist/.htaccess', dest: '<%= config.dist %>/.htaccess' }] }, styles: { expand: true, dot: true, cwd: '<%= config.app %>/styles', dest: '.tmp/styles/', src: '{,*/}*.css' } }

this in extract of 'production' gruntfile.js:

module.exports = function (grunt) { copy: { dist: { files: [{ expand: true, dot: true, cwd: '<%= yeoman.app %>', dest: '<%= yeoman.dist %>', src: [ //'*.{ico,png,txt}', '*.{txt}', '.htaccess', '*.html', '*.appcache', 'views/{,*/}*.html', 'images/{,*/}*.{webp}', 'icons/**/*.{ico,png}', 'scripts/i18n/{,*/}*.js', 'i18n/{,*/}*.json', ] }, { expand: true, cwd: '.tmp/images', dest: '<%= yeoman.dist %>/images', src: ['generated/*'] }, { expand: true, cwd: 'bower_components/bootstrap/dist', src: 'fonts/*', dest: '<%= yeoman.dist %>' }, { expand: true, cwd: 'bower_components/open-sans-fontface', src: 'fonts/**/*', dest: '<%= yeoman.dist %>/styles' }, { expand: true, cwd: 'bower_components/font-awesome', src: 'fonts/*', dest: '<%= yeoman.dist %>' }] }, }, ... grunt.registertask('build', [ 'clean:dist', ... 'copy:dist', ... ]); grunt.registertask('default', [ 'build', ]); };

please, read http://gruntjs.com/getting-started (it's 5 minutes task... :-).

javascript gruntjs yeoman bower

No comments:

Post a Comment