New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grunt-htmlgen

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-htmlgen - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

test/expected/sample.html

55

Gruntfile.js

@@ -5,2 +5,13 @@ module.exports = function(grunt) {

grunt.initConfig({
meta: {
single_file_with_template: {
title: 'Title',
css: 'styles/style.css',
js: 'scripts/script.js',
},
sample: {
css_reset: 'styles/reset.css',
js_index: 'scripts/index.js'
}
},
clean: {

@@ -21,15 +32,43 @@ test: ['tmp/*']

single_file: {
title: 'Title',
css: 'styles/style.css',
js: 'scripts/script.js',
dest: 'tmp/single_file.html'
dest: 'tmp/single_file.html',
options: {
title: 'Title',
css: 'styles/style.css',
js: 'scripts/script.js'
}
},
single_file_with_template: {
dest: 'tmp/single_file.html',
options: {
title: '<%= meta.single_file_with_template.title %>',
css: '<%= meta.single_file_with_template.css %>',
js: '<%= meta.single_file_with_template.js %>',
}
},
multiple_files: {
title: 'Title',
css: ['styles/style1.css', 'styles/style2.css', 'styles/style3.css'],
js: ['scripts/script1.js', 'scripts/script2.js', 'scripts/script3.js'],
dest: 'tmp/multiple_files.html'
dest: 'tmp/multiple_files.html',
options: {
title: 'Title',
css: ['styles/style1.css', 'styles/style2.css', 'styles/style3.css'],
js: ['scripts/script1.js', 'scripts/script2.js', 'scripts/script3.js']
}
},
no_file: {
dest: 'tmp/no_file.html'
},
sample: {
dest: 'tmp/sample.html',
options: {
title: 'Title',
css: [
'<%= meta.sample.css_reset %>',
'styles/style1.css',
'styles/style2.css'
],
js: [
'scripts/script1.js',
'scripts/script2.js',
'<%= meta.sample.js_index %>'
],
}
}

@@ -36,0 +75,0 @@ },

2

package.json
{
"name": "grunt-htmlgen",
"description": "Grunt task to generate HTML files with stylesheet and script elements.",
"version": "0.0.1",
"version": "0.1.0",
"author": {

@@ -6,0 +6,0 @@ "name": "Jatesadakarn Seangrat",

@@ -9,16 +9,30 @@ # grunt-htmlgen

## Options
## Configurations
### dest
[String] Location of the generated HTML file.
### title
[String] Title of the page to generate (optional).
Type: `String`
### css (optional)
[String|Array] URL or array of URLs of stylesheets to include (optional).
Location of the generated HTML file.
### js (optional)
[String|Array] URL or array of URLs of scripts to include (optional).
### options
#### title
Type: `String`
Title of the page to generate.
#### css (optional)
Type: `String`, `Array`
URL or array of URLs of stylesheets to include.
#### js (optional)
Type: `String`, `Array`
URL or array of URLs of scripts to include.
## Samples

@@ -32,8 +46,24 @@

grunt.initConfig({
meta: {
sample: {
css_reset: 'styles/reset.css',
js_index: 'scripts/index.js'
}
}
htmlgen: {
index: {
title: 'Title',
css: ['styles/style1.css', 'styles/style2.css', 'styles/style3.css'],
js: ['scripts/script1.js', 'scripts/script2.js', 'scripts/script3.js'],
dest: 'index.html'
sample: {
dest: 'tmp/sample.html',
options: {
title: 'Title',
css: [
'<%= meta.sample.css_reset %>',
'styles/style1.css',
'styles/style2.css'
],
js: [
'scripts/script1.js',
'scripts/script2.js',
'<%= meta.sample.js_index %>'
],
}
}

@@ -48,3 +78,3 @@ }

### Result after run ``grunt`` (index.html)
### Content of ``tmp/sample.html`` after run ``grunt`` or ``grunt:sample``

@@ -56,5 +86,5 @@ <!doctype html>

<title>Title</title>
<link rel="stylesheet" type="text/css" href="styles/reset.css">
<link rel="stylesheet" type="text/css" href="styles/style1.css">
<link rel="stylesheet" type="text/css" href="styles/style2.css">
<link rel="stylesheet" type="text/css" href="styles/style3.css">
</head>

@@ -64,4 +94,9 @@ <body>

<script src="scripts/script2.js"></script>
<script src="scripts/script3.js"></script>
<script src="scripts/index.js"></script>
</body>
</html>
## Release history
* 2013-02-14    v0.1.0    Change the configuration by moving title, css, js options into the options.
* 2013-02-14    v0.0.1    First release.

@@ -42,5 +42,8 @@ 'use strict';

grunt.registerMultiTask('htmlgen', 'Generate HTML', function() {
this.files.forEach(function(f) {
var content = createHTMLString(f);
grunt.file.write(f.dest, content);
var options = this.options(),
content = createHTMLString(options);
this.files.forEach(function(file) {
grunt.file.write(file.dest, content);
grunt.log.writeln('File "' + file.dest + '" created.');
});

@@ -47,0 +50,0 @@ });

@@ -17,2 +17,14 @@ var grunt = require('grunt');

single_file_with_template: function(test) {
'use strict';
test.expect(1);
var actual = grunt.file.read('tmp/single_file.html');
var expected = grunt.file.read('test/expected/single_file.html');
test.equal(actual, expected, 'should generate a HTML with a script and a style that are applied template in their names');
test.done();
},
multiple_files: function(test) {

@@ -40,4 +52,16 @@ 'use strict';

test.done();
},
sample: function(test) {
'use strict';
test.expect(1);
var actual = grunt.file.read('tmp/sample.html');
var expected = grunt.file.read('test/expected/sample.html');
test.equal(actual, expected, 'should generate a HTML in sample readme correctly');
test.done();
}
};

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc