package
Inserting the contents of external CSS and JavaScript files directly into the HTML document
npm install grunt-assetserGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 5 packages.
116.5 kB
Includes dependencies.
3 direct · 2 outdated
Inserting the contents of external CSS and JavaScript files directly into the HTML document.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-assetser --save-devOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-assetser');Run this task with the grunt assetser command.
Task targets, files and options may be specified according to the Grunt Configuring tasks guide.
Type: String Default: empty string
This string will be used as the path to the resources that will be added in the HTML files. This is a required parameter!
Type: String Boolean Default: false
Add only those files that contain in its name, the specified string.
If you choose true, then will be used value ._inline.
Type: String Default: empty string
Add only files the type specified by in this parameter. Supported: js, css.
Type: Boolean Default: true
Display information about the processed files.
Running "assetser:default_options" (assetser) task
>> The file tmp/default.html has been successfully created.
>> The file tmp/default_tab.html has been successfully created.// assets/file.js
( function () { ... } )();// assets/file.css
.class { ... }<!doctype html>
<html lang="en">
<head>
...
<style>.class{ ... }</style>
</head>
<body>
...
<script>(function(){ ... })();</script>
</body>
</html>grunt.initConfig({
assetser: {
main: {
options: {
assetsDir: 'app/assets'
},
// like this
files: {
'build/index.html': 'app/index.html',
'tmp/test.html': 'app/index.html'
}
// or
src: 'app/index.html',
dest: 'build/index.html'
}
}
});grunt.initConfig({
assetser: {
main: {
options: {
assetsDir: 'app/assets'
},
files: [{
expand: true,
cwd: 'app',
src: '*.html',
dest: 'build'
}]
}
}
});grunt.initConfig({
assetser: {
main: {
options: {
assetsDir: ['app/assets/styles', 'app/assets/scripts']
},
files: [{
expand: true,
cwd: 'app',
src: '*.html',
dest: 'tmp'
}]
}
}
});