Ember CLI Funnel - File Exclusion

0.6.1 · maintenance · verified Tue Apr 21

`ember-cli-funnel` is an Ember CLI addon designed to exclude specific files or directories from an Ember application's build output. It integrates directly into the `ember-cli-build.js` file, allowing developers to define exclusion patterns using glob syntax within the `EmberApp` configuration. The current stable version, 0.6.1, suggests it's still in a pre-1.0 development phase, implying that its API might not be fully stable, though the core functionality of file funnelling via Broccoli is well-established. Its release cadence appears to be driven by contributions and maintenance, as indicated by a recent dependency update in September 2023 despite the low version number. Key differentiators include its straightforward configuration within the standard Ember build process and its ability to dynamically exclude files based on environment variables or Git branch information, providing fine-grained control over the final build artifact size and content for different deployment targets.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to configure `ember-cli-funnel` within `ember-cli-build.js` to exclude specific application routes and addon styles from the final build output based on glob patterns and environment.

// ember-cli-build.js
'use strict';

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const path = require('path');

module.exports = function(defaults) {
  let app = new EmberApp(defaults, {
    // Configure ember-cli-funnel to exclude specific files from the build
    funnel: {
      // Array of glob patterns for files/directories to exclude
      exclude: [
        // Exclude an entire route folder named 'style-guide' from the app's output
        `${defaults.project.pkg.name}/routes/style-guide/**/*`,
        // Exclude SCSS files from a specific addon's tree output
        'addon-tree-output/some-addon/styles/**/*.scss'
      ],
      // The 'enabled' option defaults to true only in production. 
      // Explicitly enable it for other environments if needed.
      enabled: process.env.EMBER_ENV === 'development' || process.env.EMBER_ENV === 'production'
    }
  });

  // Return the final Broccoli tree for the build process
  return app.toTree();
};

view raw JSON →