gruntjs - Yeoman & Grunt, how to only include on build -


i'm using yeoman build angular app.

there section of javascript want included on page when built (into dist folder).

is there way tell grunt tasks running 'grunt server' during development skip part of template , include in build?

this sounds perfect use-case grunt-processhtml.

it allows place directives in html. in case remove directive you're looking for:

<!-- build:remove --> <p>this removed when process done</p> <!-- /build -->  <!-- build:dist:remove --> <p>but 1 when doing processhtml:dist</p> <!-- /build --> 

you can of course turn around , have snippet removed in server mode. if configure task output html in .tmp/, connect server automatically serve file there.

you add processhtml task task list server, e.g.:

grunt.task.run([   'clean:server',   'concurrent:server',   'autoprefixer',   'processhtml:server',   'connect:livereload',   'open',   'watch' ]); 

and watch section later changes trigger update of file:

watch: {   html: {     files: ['<%= yeoman.app %>/*.html'],     tasks: ['processhtml:server']   } } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -