4.1.2 • Published 7 days ago

@ecl/builder v4.1.2

Weekly downloads
253
License
EUPL-1.2
Repository
-
Last release
7 days ago

ECL Builder

Configuration

By default, ecl-builder will read the ecl-builder.config.js file at the root of your project. You can use the -c or --config parameter if you want to give your configuration file another name.

Typically, this is what it should look like:

const path = require('path');
const isProd = process.env.NODE_ENV === 'production';

module.exports = {
  // Compile entry.js
  scripts: [
    {
      entry: path.resolve(__dirname, 'src/entry.js'),
      dest: path.resolve(__dirname, 'dist/output.js'),
      options: {
        sourceMap: isProd ? false : 'inline',
        moduleName: 'myModule',
      },
    },
  ],
  // Compile entry.scss
  styles: [
    {
      entry: path.resolve(__dirname, 'src/entry.scss'),
      dest: path.resolve(__dirname, 'dist/output.css'),
      options: {
        sourceMap: isProd ? 'file' : true,
        minify: true,
      },
    },
  ],
  // Copy files from src to dest
  copy: [
    {
      from: path.resolve(__dirname, 'src/fonts'),
      to: path.resolve(__dirname, 'dist/fonts'),
    },
    {
      from: path.resolve(__dirname, 'src/images'),
      to: path.resolve(__dirname, 'dist/images'),
    },
  ],
};

Watch mode

ECL builder provides a thin wrapper on top of browsersync for facilitating development workflows with the assets mentioned above.

Example configuration:

{
    init: {
      proxy: `${app.host}:${app.port}`,
    },
    handlers: [
      {
        pattern: `./(dev|ec-core)/src/*.scss`,
        events: [
          {
            on: 'change',
            name: 'dev/ec-core presets scss changes',
            command: 'npm run build:styles',
            message: 'New styles ready',
            reload: '*.css',
          },
        ],
      },
    ]
}

The object passed to init is merged with the same method from browsersync. ECL uses the proxy option for it's storybook instances, but this could be any other application such as a Drupal website.

handlers define a list of event handlers spawning .watch() tasks.

The value for on property matches the chokidar's events.

reload is the same as browsersync's reload(). It's optional and could be most useful in handlers related to changes in styles (scss/css) which can be injected on the page without full page reload with reload("*.css"). In all other cases, passing the function with empty parameters will cause a full page reload.

4.1.2

7 days ago

4.1.1

21 days ago

4.1.0

28 days ago

4.0.2

1 month ago

4.0.1

2 months ago

4.0.0

2 months ago

4.0.0-beta-3

2 months ago

4.0.0-beta-2

2 months ago

4.0.0-beta-1

3 months ago

3.13.0

4 months ago

3.12.1

5 months ago

3.12.0

5 months ago

3.9.1

10 months ago

3.9.0

10 months ago

3.10.0

8 months ago

3.8.5

10 months ago

3.11.0

6 months ago

3.11.1

6 months ago

3.8.0

12 months ago

3.8.4

11 months ago

3.8.3

11 months ago

3.8.2

11 months ago

3.8.1

12 months ago

3.7.1

1 year ago

3.7.0

1 year ago

3.6.0

1 year ago

3.4.2

2 years ago

3.5.1

1 year ago

3.5.0

2 years ago

3.4.0

2 years ago

3.4.1

2 years ago

3.3.4

2 years ago

3.3.3

2 years ago

3.3.1

2 years ago

3.3.0

2 years ago

3.3.2

2 years ago

3.2.4

2 years ago

3.2.2

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

3.2.3

2 years ago

3.1.3

2 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.39.0

3 years ago

3.0.0-beta.2

3 years ago

3.0.0-beta.1

3 years ago

3.0.0-alpha.1

3 years ago

2.38.0

3 years ago

2.37.0

3 years ago

2.36.0

3 years ago

2.35.0

3 years ago

2.34.0

4 years ago

2.33.1

4 years ago

2.33.0

4 years ago

2.32.0

4 years ago

2.31.0

4 years ago

2.30.0

4 years ago

2.29.0

4 years ago

2.28.0

4 years ago

2.28.3

4 years ago

2.27.0

4 years ago

2.26.0

4 years ago

2.25.0

4 years ago

2.24.0

4 years ago

2.23.0

4 years ago

2.22.1

4 years ago

2.22.0

4 years ago

2.21.0

4 years ago

2.20.0

4 years ago

2.19.0

4 years ago

2.18.0

4 years ago

2.17.3

4 years ago

2.17.2

4 years ago

2.17.0

4 years ago

2.16.0

4 years ago

2.15.0

4 years ago

2.14.0

5 years ago

2.13.0

5 years ago

2.12.0

5 years ago

2.11.0

5 years ago

2.10.1

5 years ago

2.10.0

5 years ago

2.9.0

5 years ago

2.8.0

5 years ago

2.7.0

5 years ago

2.6.0

5 years ago

2.5.0

5 years ago

2.4.0

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.1

5 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago