grunt-html-build
Grunt HTML Builder - Appends scripts and styles, Removes debug parts, append html partials, Template options
Getting Started
Install this grunt plugin next to your project's gruntfile with: npm install grunt-html-build --save-dev
Then add this line to your project's Gruntfile.js
:
grunt;
Then specify your config: (more informations)
grunt;
Using the configuration above, consider the following example html to see it in action:
grunt-html-build - Test Page <!-- build:style bundle --> <!-- /build --> <!-- build:style inline test --> <!-- /build --> <!-- build:section layout.header --> <!-- /build --> <!-- build:section recursive views --> <!-- /build --> <!-- build:section layout.footer --> <!-- /build --> <!-- build:remove --> <!-- /build --> <!-- build:remove dev --> <!-- /build --> <!-- build:script bundle --> <!-- /build --> <!-- build:process --> <!-- /build --> <!-- build:script inline main --> <!-- /build --> <!-- build:script inline noprocess main --> <!-- /build --> <!-- build:section optional test --> <!-- /build -->
After running the grunt task it will be stored on the samples folder as
grunt-html-build - Test Page ... ... ... ... ...
There 5 types of processors:
- script
- append script reference from configuration to dest file.
- style
- append style reference from configuration to dest file.
- section
- append partials from configuration to dest file.
- process
- process grunt template on the block.
- remove
- it will erase the whole block.
Release History
- 0.1.0 Initial Release
- 0.1.1 Cleaning, adding optional tags, using js-beautify
- 0.1.2 Adding expand options to tags paths and write docs
- 0.1.3 Fixing nodejs dependencies
- 0.1.4 Fixing nodejs dependencies
- 0.1.5 Optimize src loop / Fix js-beautify options
- 0.1.6 Allow build tag customization
- 0.2.0
- Fix and optimisation
- Allow replacing src file by built file
- Allow filename in dest path
- Allow prefixing src files
- 0.2.1 Allow non relative file names + per file tag parameter
- 0.2.2 Fix issue in options.relative
- 0.3.0
- Fix issue when building multiple html files using custom file globbing
- Allow sub parameters in all options paths
- 0.3.1
- Fix issue when using prefix on Windows environment
- 0.3.2
- Update js-beautify dependency to 1.4.2
- Remove peerDependencies to avoid versions conflict
- 0.4.0
- Fix bug in prefix option
- Allow recursive build using section processor
- 0.4.1
- Fix prefix's ability to contain //, as in https://
- Add a new recursive option which can be added to section tag.
- 0.4.2
- Fix relative path error since 0.4.0
- Add noprocess option to tags to avoid underscore processing issues.
- 0.4.3
- Allow remove task to be configured by using current target.
- 0.5.0
- Avoid javascript errors when parsing unknown tags.
- Add an
allowUnknownTags
option to ignore unknown tags without failing the task. - Allow to specify
attributes
on script and styles tags. - Allow http, https or // links to be processed as links.
- Automatically adapt generated
link
tag for less files.
- 0.5.1
- Fix issue in linefeed simplification
- 0.5.2
- Fix issue in relative path management
- Remove deprecated undercore reference and replace by lodash dependency
- Fix deep array flattening for Node.JS >= 4
- 0.6.0
- Add
keepTags
option to keep htmlbuild tags after build. - Fix broken inlining for scripts containing
$x
. - Upgrade
lodash
to v4 and fix template issue. - Ensure
grunt
v1.0.0 compatibility.
- Add
- 0.6.1
- Optimize some code parts.
- Added option
basePath
allow keeping original folder structure.
- 0.6.2
- Fix some issues.
- 0.7.0
- Fix EOL inconsistent issue.
- Add suffix option to customize files query parameters (for cache).