0.0.4 • Published 11 years ago

script-extractor v0.0.4

Weekly downloads
2
License
-
Repository
-
Last release
11 years ago

grunt-script-extractor

Extract the script sources from a html file and pass them to uglify task.

example Gruntfile.js:

module.exports = function (grunt) {
	'use strict';

	var scriptExtractor = require('grunt-script-extractor')(grunt);

	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		uglify: {
			options: {
				banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
				report: 'min'
			},
			build: {
				files: {
					'dist/app.min.js': scriptExtractor('index.html')
				}
			}
		}
	});
	grunt.loadNpmTask('grunt-contrib-uglify');
	grunt.loadNpmTask('grunt-script-extractor');

	grunt.registertask('default', ['uglify']);
};

scriptExtractor(htmlFile, [prefix])

Search through htmlFile for script tags and return an array of each script tags src value, prefixed by optional prefix.

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago