grunt-includes-basic

0.0.1 • Public • Published

grunt-includes-basic

Requires grunt ~0.4.0

A grunt task for including a file within another file. Circular imports will break the recursive strategy.

Getting Started

Install this grunt plugin next to your project's Gruntfile.js with: npm install grunt-includes-basic --save

Then add this line to your project's Gruntfile.js:

grunt.loadNpmTasks('grunt-includes-basic');

Options

includeRegexp

Type: RegExp

Sets the regular expression used to find include statements. The file path should always be the $1.

Usage

You can use this plugin to build html templates.

includes: {
  files: {
    src: ['path/to/foo.html', 'path/to/bar.html'], // Source files
    dest: 'tmp', // Destination directory
    flatten: true,
    cwd: '.'
  }
}

Example

index.html

<html>
<head>
  <title>Show me</title>
</head>
<body>
  include "content.html"
</body>
</html>

content.html

<div class="content">
  <h1>Content</h1>
  <p>More content</p>
</div>

Produces

<html>
<head>
  <title>Show me</title>
</head>
<body>
<div class="content">
  <h1>Content</h1>
  <p>More content</p>
</div>
</body>
</html>

Forked and stripped version of grunt-includes by Matt McFarland.

Readme

Keywords

none

Package Sidebar

Install

npm i grunt-includes-basic

Weekly Downloads

0

Version

0.0.1

License

none

Last publish

Collaborators

  • jodaka