grunt-component-build
raw JSON → 0.5.3 verified Sat May 09 auth: no javascript maintenance
A Grunt plugin to build and watch component(1) packages. It wraps the component build.js library (builder2.js) to compile component projects within a Grunt workflow. Latest version is 0.5.3, supporting component 1.0.0+ and builder2.js plugins (e.g., CoffeeScript, Jade). It provides task configuration for development, standalone builds, CSS prefixing, and asset copying. The plugin is in maintenance mode; the component ecosystem has largely shifted to modern build tools.
Common errors
error Warning: Task "componentbuild" not found. ↓
cause Plugin not loaded or not installed.
fix
Run
npm install grunt-component-build --save-dev and add grunt.loadNpmTasks('grunt-component-build'); to Gruntfile. error Running "componentbuild:dev" (componentbuild) task Fatal error: Cannot find module 'component-build2' ↓
cause Missing peer dependency component-build2.
fix
Install component-build2:
npm install component-build2 --save-dev error Fatal error: Unable to read component.json file ↓
cause Missing component.json in the source directory.
fix
Ensure a valid component.json exists in the source path.
error Error: build.use is not a function ↓
cause Builder2.js plugin using old builder API.
fix
Use plugins that support builder2.js or update plugin code.
Warnings
breaking Version 0.5.0 drops support for component-build <1.0.0; uses builder2.js API. ↓
fix Upgrade to 0.5.0+ and update component configuration to match builder2.js.
deprecated Grunt 0.4.0+ required; older Grunt versions are unsupported. ↓
fix Use Grunt 0.4.0 or later.
gotcha Task name is 'componentbuild' (all lowercase), not 'componentBuild'. ↓
fix Use 'componentbuild' in grunt.initConfig.
breaking Version 0.4.0 refactored to support Grunt 0.4.0+ breaking changes from 0.3.x. ↓
fix Update to Grunt 0.4.0+ and upgrade plugin to 0.4.0+.
deprecated The component ecosystem is largely abandoned; consider modern alternatives like Webpack or Parcel. ↓
fix Migrate away from component(1) to a supported build system.
Install
npm install grunt-component-build yarn add grunt-component-build pnpm add grunt-component-build Imports
- componentbuild wrong
const componentBuild = require('grunt-component-build');correctgrunt.loadNpmTasks('grunt-component-build'); - default import wrong
npm install --save grunt-component-buildcorrectnpm install grunt-component-build --save-dev - task registration wrong
grunt.config.set('componentBuild', { ... });correctgrunt.initConfig({ componentbuild: { ... } });
Quickstart
// Install: npm install grunt-component-build --save-dev
// Gruntfile.js
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-component-build');
grunt.initConfig({
componentbuild: {
options: {
name: 'myapp',
development: true
},
src: 'src/components',
dest: 'public/build'
}
});
grunt.registerTask('default', ['componentbuild']);
};