Huge News!Announcing our $40M Series B led by Abstract Ventures.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

Grunt task to generate HTML files with stylesheet and script elements.

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

grunt-htmlgen

Grunt (0.4.x) task to generate HTML files with stylesheet and script elements.

Configuration

htmlgen is a multi task so any targets, files and options should be specified according to the multi task documentation.

Brief configuration guide:

  1. Add grunt-htmlgen in devDependency in package.json.
  2. Run npm install in your project's directory to install the dependencies.
  3. Edit Gruntfile.js to use this task:
    1. Add grunt.loadNpmTasks('grunt-htmlgen');
    2. Add htmlgen: { // Your configuration } in grunt.initConfig

Configurations

dest

Type: String

Location of the generated HTML file.

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

Gruntfile.js

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

  grunt.initConfig({
    meta: {
      sample: {
        css_reset: 'styles/reset.css',
        js_index: 'scripts/index.js'
      }
    }
    htmlgen: {
      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 %>'
          ],
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-htmlgen');
  grunt.registerTask('default', ['htmlgen']);

};

Content of tmp/sample.html after run grunt or grunt:sample

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<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">
</head>
<body>
<script src="scripts/script1.js"></script>
<script src="scripts/script2.js"></script>
<script src="scripts/index.js"></script>
</body>
</html>

Release history

  • 2013-02-18    v0.1.1    Update development dependencies for Grunt 0.4.0
  • 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.

Keywords

FAQs

Package last updated on 18 Feb 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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