1.1.0 • Published 7 years ago

grunt-resources-html v1.1.0

Weekly downloads
20
License
-
Repository
github
Last release
7 years ago

grunt-resources-html

Extract the resources from a html file (script-css) and deposit to a destination folder

Getting Started

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');

The "grunt_resources_html" task

Overview

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.
    },
  },
});

Options

options.sort

Type: Boolean

Enumerates resources in the order they appear in the html file.

Usage Examples

Default Options

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>

task grunt_resources_html

grunt.initConfig({
  grunt_resources_html: {
      options: {
        verbose: false,
        sort: true
      },
      dist: {
        src: ['test/index.html'],
        dest: 'test/resources-des/'
      }
    }
});

run task grunt_resources_html result

├── gruntfile.js
└── test
    └── resources-dest
        └── 1_bootstrap.min.css
        └── 2_jquery-1.11.3.min.js

Compile Typescript

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

Contributing

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.

Release History

  • 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
1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.1

7 years ago