Extract the resources from a html file (script-css) and deposit to a destination folder
This plugin requires Grunt ~0.4.5
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-resources-html --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-resources-html');
In your project's Gruntfile, add a section named grunt_resources_html
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
grunt_resources_html: {
your_target: {
// Target-specific file lists and/or options go here.
},
},
});
Type: Boolean
Enumerates resources in the order they appear in the html file.
In this example, resources are extracted from src to copied to dest.
<!DOCTYPE html>
<html>
<head>
<link href="test/resources-origin/bootstrap.min.css" rel="stylesheet" />
<script src="test/resources-origin/jquery-1.11.3.min.js"></script>
</head>
<body>
</body>
</html>
grunt.initConfig({
grunt_resources_html: {
options: {
verbose: false,
sort: true
},
dist: {
src: ['test/index.html'],
dest: 'test/resources-des/'
}
}
});
├── gruntfile.js
└── test
└── resources-dest
└── 1_bootstrap.min.css
└── 2_jquery-1.11.3.min.js
To compile changes made to the TS source file, you must run the grunt exec task
grunt exec
Or execute the key combination ctrl + shift + B
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.
- 2017-07-20 v1.1.0 New option sort
- 2017-07-11 v1.0.3 Further edits of readme.md
- 2017-07-07 v1.0.0 Initial commits