Skip to content

How do I specify separate target subdirectories for bundled scripts and styles?

Alex Weissman edited this page Mar 23, 2016 · 1 revision

Suppose you want to specify separate target directories for different types of assets. For example, you might want your bundled Javascript assets written to public/js/, but CSS assets written to public/css/:

target output

/public/
 |-- js/
     |-- main-<hash>.js
 |-- css/
     |-- main-<hash>.css

To do this, you should define separate bundles for the JS and CSS assets. You can specify the target subdirectories in the names of these bundles, for example js/main and css/main:

// bundle.config.js
module.exports = {
  bundle: {
    'js/main': {
      scripts: './*.js'
    },
    'css/main': {
      styles: './*.css'
    }
  }
};

See #76 and #49 for more details.