Ember CLI Node Assets

0.2.2 · abandoned · verified Sun Apr 19

Ember CLI Node Assets is an Ember CLI addon designed to simplify the inclusion of stylesheets, images, and JavaScript assets directly from npm packages into Ember applications and other Ember addons. As of its last major update, v0.2.2, released in 2020, the package appears to be in an abandoned state with no recent maintenance or updates. Its primary function is to funnel specified files from an npm package into an Ember application's `vendor` (for `app.import` consumption) or `public` (for direct public access) directories during the build process. It differentiates itself by providing a consistent configuration API, handling npm package layout variations (npm 2 vs 3), and abstracting away direct interaction with Broccoli plugins, which are the underlying build tools for Ember CLI. It encourages a pattern of explicitly funneling assets rather than implicit imports, allowing for fine-grained control over asset placement and inclusion.

Common errors

Warnings

Install

Imports

Quickstart

This example demonstrates how to configure `ember-cli-node-assets` in an Ember application's `ember-cli-build.js` to funnel assets from the `slick-carousel` npm package into both the `vendor` and `public` trees, followed by `app.import` calls for vendor assets.

/* ember-cli-build.js for an Ember application */
const EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
  let app = new EmberApp(defaults, {
    nodeAssets: {
      'slick-carousel': {
        vendor: {
          srcDir: 'slick',
          destDir: 'slick-carousel',
          include: ['slick.js', 'slick.css', 'slick-theme.css']
        },
        public: {
          srcDir: 'slick',
          destDir: 'assets',
          include: ['ajax-loader.gif', 'fonts/*']
        }
      }
    }
  });

  // Import assets that were funneled into the vendor tree
  app.import('vendor/slick-carousel/slick.js');
  app.import('vendor/slick-carousel/slick.css');
  app.import('vendor/slick-carousel/slick-theme.css');

  return app;
};

view raw JSON →