Grunt task to preprocess JS files using preprocessor.
Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-preprocessor.
Then add this line to your project's grunt.js gruntfile:
grunt.loadNpmTasks("grunt-preprocessor");Include path
Type: String Default: grunt.util.linefeed
Multiple files will be joined on this string. If you're processing concatenated JavaScript files with a minifier, you may need to use a semicolon ';' as the separator.
Preprocessor context.
Merge preprocessor context with the process environment variables. Default true.
grunt.initConfig({ preprocessor: { main: { options: { root: "app/includes", context: { DEBUG: true } }, files: { "build/main.js": "app/main.js" } } } });Concat multiple files and process them
grunt.initConfig({ preprocessor: { main: { options: { root: "app/includes", context: { DEBUG: true } }, files: { "build/main.js": "app/main.js", "build/extras.js": ["app/libs.js", "app/additional.js"], } } } });In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
- 01/02/2016 - 0.6.1: ESLint remake
- 01/02/2016 - 0.5.1: Based on https://github.com/nashdot/Preprocessor.js
- 11/02/2013 - 0.4.0: Update grunt-contrib-jshint / Remove grunt.util._ (@shinnn)
- 07/02/2013 - 0.3.0: Support multiple targets and globbing (@rvock)
- 20/08/2013 - 0.2.0: Introduce context with process.env merge.
- 26/07/2013 - 0.1.0: Initial release.
Copyright (c) 2014 Stanislav Lesnikov and contributors Licensed under the MIT license.