node.js - Problems using grunt-preprocess -


i trying use grunt-preprocess module having difficulty getting ifdefs work.

here gruntfile

module.exports = function(grunt) { // configuratuion goes here  grunt.initconfig({    preprocess : {      options: {       context : {         debug: false       }     },      html : {       src : 'dev/index.html',       dest : 'dev/index.processed.html'     }    } });  grunt.loadnpmtasks('grunt-preprocess'); grunt.registertask('default', ['preprocess']); } 

and html

<!doctype html> <html> <head> </head> <body>  <div id="wrap">  <!-- @ifdef debug -->   <h1>test page</h1> <!-- @endif -->  <!-- @exclude --> <header>you're on dev!</header> <!-- @endexclude -->  <p>test pragraph</p>  <div id="output"></div>  </div>  </body> </html> 

but when run grunt code between debug ifdef not removed (although ifdef comments removed)

i have feeling missing critical step not mentioned in documentation.

thanks

see documentation:

@ifdef var / @endif include enclosed block if var defined (typeof !== 'undefined')

your debug-var defined (its value boolean), block included. remove completly, , should work:

options: {   context : {} } 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -