Gathering detailed insights and metrics for broccoli-importer
Gathering detailed insights and metrics for broccoli-importer
Gathering detailed insights and metrics for broccoli-importer
Gathering detailed insights and metrics for broccoli-importer
A simple tool for resolving Brocfiles defined in modules as merge-able trees
npm install broccoli-importer
Typescript
Module System
Node Version
NPM Version
65.2
Supply Chain
93.4
Quality
71.7
Maintenance
50
Vulnerability
98.2
License
JavaScript (83.81%)
HTML (16.19%)
Total Downloads
3,847
Last Day
2
Last Week
2
Last Month
19
Last Year
153
MIT License
1 Stars
35 Commits
1 Watchers
2 Branches
1 Contributors
Updated on May 02, 2024
Minified
Minified + Gzipped
Latest Version
0.2.1
Package Id
broccoli-importer@0.2.1
Size
4.69 kB
NPM Version
5.4.1
Node Version
8.4.0
Cumulative downloads
Total Downloads
2
A simple tool for exporting assets defined in modules as merge-able trees.
From NPM:
npm install broccoli-importer --save
For packages that don't contain a Brocfile in their directory, broccoli-importer
will heuristically determine a suitable strategy for exporting file trees. Authors can manually assist in this by either creating an assets
folder, or defining directories.assets
within package.json.
importTree(module)
module
{NodeJS Module ID}
1var importTree = require('broccoli-importer'), 2 mergeTrees = require('broccoli-merge-trees'); 3 4var trees = [ 5 'canjs', 6 'jquery', 7 'bourbon', 8].map(importTree); 9 10module.exports = mergeTrees(trees);
This should automagically work for most packages.
For packages that contain a Brocfile in their directory, simply require those modules as you would normally, and broccoli-importer
will take care of finding the Brocfile, and exporting a modified tree with relative paths. This offers a competitive, flexible standard for managing client side assets using npm.
In cases in which importTree
does not export as expected, you can use the alternate call signature to manually export assets within those modules, giving much greater flexibility.
importTree(module, options)
module
{CommonJS Module name}
See NodeJS Modules
Options
See Broccoli Funnel for options documentation
The working directory when configuring funnel options is the directory containing the package.json main file.
If the module you're importing has the following file structure:
├── LICENSE.md
├── README.md
├── app
│ └── assets
│ └── stylesheets <-- Working Directory while importing
│ ├── _bourbon.scss <-- Package.json Main
│ ├── addons
│ │ ├── ...
│ ├── css3
│ │ ├── ...
│ ├── functions
│ │ ├── ...
│ ├── helpers
│ │ ├── ...
│ └── settings
│ ├── ...
├── package.json
└── pkg
└── ...
And your app has the following file structure:
.
├── Brocfile.js
├── assets
│ ├── admin
│ │ ├── controller.js
│ │ ├── main.js
│ │ ├── map.js
│ │ ├── styles.scss
│ │ ├── ui
│ │ │ ├── form.scss
│ │ │ └── layout.scss
│ │ └── views
│ │ └── layout.stache
│ ├── config.js
│ ├── grid
│ │ ├── config.scss
│ │ └── core.scss
│ ├── router
│ │ ├── controller.js
│ │ └── map.js
│ ├── test
│ │ ├── config.js
│ │ ├── index.html
│ │ ├── setup.js
│ │ └── store.js
│ ├── user
│ │ ├── controller.js
│ │ ├── model.js
│ │ ├── styles.scss
│ │ ├── test
│ │ │ ├── fixtures.json
│ │ │ ├── index.html
│ │ │ ├── spec.js
│ │ │ └── store.js
│ │ └── views
│ │ ├── show.stache
│ │ ├── edit.stache
│ │ └── index.stache
│ └── util.js
├── node_modules
│ ├─- ...
├── package.json
You can select a subsection of this module via importTree:
1var mergeTrees = require('broccoli-merge-trees'), 2 importTree = require('broccoli-importer'), 3 compileSASS = require('broccoli-sass'), 4 funnel = require('broccoli-funnel'), 5 out = []; 6 7// This exports identically to `importTree('bourbon')` 8var bourbon = importTree('bourbon', { 9 srcDir: '/', // We're importing relative to node_modules/bourbon/app/assets/stylesheets 10 destDir: 'bourbon' 11}); 12 13 14// This exports identically to `importTree('canjs')`, except doesn't filter out `jquery.js` 15var CanJS = importTree('canjs', { 16 srcDir: 'dist/amd' 17}); 18 19var assets = mergeTrees([ 20 CanJS, 21 bourbon, 22 'assets' // Our local assets folder 23]); 24 25out.push(assets); 26out.push(compileSASS([assets], 'admin/styles.scss', 'admin/styles.css')); 27out.push(compileSASS([assets], 'user/styles.scss', 'user/styles.css')); 28 29var out = mergeTrees(out, { 30 overwrite: true 31}); 32 33module.exports = funnel(out, { 34 allowEmpty: true, 35 exclude: [ 36 /\.scss/ 37 ] 38});
The resulting file tree will look like:
.
├── assets
│ ├── user
│ ├── admin
│ │ ├── controller.js
│ │ ├── main.js
│ │ ├── map.js
│ │ ├── styles.css
│ │ └── views
│ │ └── layout.stache
│ ├── bourbon
│ │ └── ...
│ ├── can.js
│ ├── can
│ │ └── ...
│ ├── config.js
│ ├── jquery.js
│ ├── router
│ │ ├── controller.js
│ │ └── map.js
│ ├── test
│ │ ├── config.js
│ │ ├── index.html
│ │ ├── setup.js
│ │ └── store.js
│ ├── user
│ │ ├── controller.js
│ │ ├── model.js
│ │ ├── styles.css
│ │ ├── test
│ │ │ ├── fixtures.json
│ │ │ ├── index.html
│ │ │ ├── spec.js
│ │ │ └── store.js
│ │ └── views
│ │ ├── show.stache
│ │ ├── edit.stache
│ │ └── index.stache
│ └── util.js
Broccoli Importer was originally written by Thomas Sieverding and is licensed under the MIT license.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
57 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
0%
2
Compared to previous day
Last Week
100%
2
Compared to previous week
Last Month
-13.6%
19
Compared to previous month
Last Year
-36.3%
153
Compared to previous year