Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

grunt-component-io

hkwd320.1.0

Inject component io builds into grunt workflow

gruntplugin, component

readme

grunt-component-io

Component.io task

Getting Started

This plugin requires Grunt ~0.4.1

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-component-io --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-component-io');

The "component" task

Overview

In your project's Gruntfile, add a section named component to the data object passed into grunt.initConfig().

grunt.initConfig({
  component: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
})

Options

options.autoload

Type: Array Default value: ['scripts', 'styles', 'files']

Component requires explicity defined resources, autoload will populate appropriate sections from source folder, in component.json, eg. 'scripts': ['test/lib/a.js','test/lib/b.js'], 'styles': ['bootstrap/bootstrap.min.css', 'custom.css'], 'files': ['fonts/font.ttf'] Note: be careful using autoload: ['styles'], task will concatenate stylesheets in alphabetical order

options.convertTemplates

Type: Boolean Default value: true

Converts html files into js templates. If you want automaticly include generated templates to component.json make sure autoload: ['scripts'] is present

options.out

Type: String Default value: 'tmp/'

Folder, to place the output of component build, (build.js)

options.standalone

Type: String Default value: null

Standalone package name. If present, will build component in standalone mode, eg. window['standalone_pkg_name'] = require('package'); Otherwise normal component wrapper will be used, eg. require('package');

Usage Examples

Default Options

In this example, the default options are used to do build component from lib folder. All javascript files will be placed in tmp/build.js, all html files will be converted to templates (index.html > index.js) and added to build.js, all css files will be concatenated and placed in tmp/build.css, all other files will be referenced in component.json under files, symlink will be created tmp/<%= component.name %>/lib/fonts/font.ttf

grunt.initConfig({
  component_io: {
    default: ['lib/**/*'],
  },
})

Contributing

feel free to

Release History

0.1.0 - initial release

changelog

v0.5.0: date: 2013-07-15 changes:

- Use rimraf directly, version 2.2.1 to fix issue on Windows.
- Add no-write option to mimic grunt.file.delete behavior.

v0.4.1: date: 2013-04-16 changes:

- Check if file exists to avoid trying to delete a non-existent file.

v0.4.0: date: 2013-02-15 changes:

- First official release for Grunt 0.4.0.

v0.4.0rc6: date: 2013-01-18 changes:

- Updating grunt/gruntplugin dependencies to rc6.
- Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions.

v0.4.0rc5: date: 2013-01-09 changes:

- Updating to work with grunt v0.4.0rc5.
- Switching to this.filesSrc api.

v0.4.0a: date: 2012-12-07 changes:

- Conversion to grunt v0.4 conventions.
- Remove node v0.6 and grunt v0.3 support.
- Add force option to bypass CWD check.

v0.3.0: date: 2012-09-23 changes:

- Options no longer accepted from global config key.

v0.2.0: date: 2012-09-10 changes:

  • Refactored from grunt-contrib into individual repo.