broccoli-static-compiler
raw JSON → 0.2.2 verified Fri May 01 auth: no javascript deprecated
Deprecated Broccoli plugin for copying static files with optional filtering and directory restructuring. The last published version (0.2.2) is no longer maintained. Replaced by broccoli-funnel since 2015. Does not support Broccoli 1.x or Node.js modern versions. Known for simple src/dest directory mapping and glob-based file selection. Alternatives: broccoli-funnel (recommended), broccoli-file-creator, or manual copy with broccoli-merge-trees.
Common errors
error Error: Cannot find module 'broccoli-static-compiler' ↓
cause Package not installed or removed from npm.
fix
Install broccoli-funnel instead: npm install --save-dev broccoli-funnel, then update code.
error TypeError: pickFiles is not a function ↓
cause Incorrect import pattern (e.g., named import instead of default).
fix
Use: var pickFiles = require('broccoli-static-compiler');
error Error: Broccoli 1.x incompatible ↓
cause This plugin relies on Broccoli 0.x APIs.
fix
Switch to broccoli-funnel which supports both 0.x and 1.x.
Warnings
deprecated broccoli-static-compiler is deprecated. Use broccoli-funnel instead. ↓
fix Replace require('broccoli-static-compiler') with require('broccoli-funnel') and adjust options (srcDir -> srcDir, destDir -> destDir, files -> allowFiles).
breaking Package does not work with Broccoli 1.x and modern Node.js versions (>=10). ↓
fix Upgrade to broccoli-funnel which supports Broccoli 1.x and Node.js >=8.
gotcha The 'files' option requires explicit array of glob patterns; if omitted, all files from srcDir are copied. ↓
fix Always specify 'files' if you want to filter, or omit to copy all. Note that empty array copies no files.
gotcha srcDir and destDir are required; relative paths are resolved from the Broccoli working directory, not the project root. ↓
fix Use absolute paths or ensure paths are correct relative to Broccoli's working directory.
Install
npm install broccoli-static-compiler yarn add broccoli-static-compiler pnpm add broccoli-static-compiler Imports
- default wrong
import pickFiles from 'broccoli-static-compiler';correctvar pickFiles = require('broccoli-static-compiler'); - default named wrong
const { pickFiles } = require('broccoli-static-compiler');correctvar pickFiles = require('broccoli-static-compiler');
Quickstart
var pickFiles = require('broccoli-static-compiler');
var sourceTree = 'app';
var imagesTree = pickFiles(sourceTree, {
srcDir: '/images',
files: ['**/*.png', '**/*.jpg'],
destDir: '/assets'
});
module.exports = imagesTree;