aurelia / bundler

A library for bundling JavaScript, HTML and CSS for use with SystemJS.
MIT License
37 stars 25 forks source link

How to bundle folder of JSON files? #158

Closed TimBailey-pnk closed 4 years ago

TimBailey-pnk commented 7 years ago

Hi, done a bunch of googleing and cant find a way to create a bundle that only contains .json files. Background: I'm using Aurelia-i18n and have a folder with the translation files ie /locales/en/root.json etc I want to have a hashed bundle with all these files inside. ie app-locales-abcdef123.js I know how to load from text/json files using SystemJS, but how to get them into a bundle just cant get it to work.

Any tips please?

TimBailey-pnk commented 7 years ago

I've got this is in my bundles.js, and tried a few dozen combinations.....


      "includes": [
        "locales/**/*.json!json"
      ],
      "options": {
        "inject": false,
        "minify": true,
        "depCache": false,
        "rev": true
      }
    },```
TimBailey-pnk commented 7 years ago

Hi @ahmedshuhel any suggestions on this one.

Thanks Tim

jp7677 commented 7 years ago

@TimBailey-pnk Your snippet looks fine. We are doing:

'app-bundle': {
        includes: [
          '[./src/app/**/*.js]',
          './src/app/**/*.html!text',
          './src/styles/**/*.css!css',
          './src/translations/**/*.json!json',
...

and it does work. I do note that we are using ./, but not sure if it makes a difference.

Are your sure that they are not part of your bundle? Do you have the json plugin ("json": "github:systemjs/plugin-json@~0.3.0") in your package.json?

TimBailey-pnk commented 7 years ago

Thanks for the reply, I do have the json plugin installed, the 2 differences I can see are that your translations are "under" src whereas mine are at the root, and your translations are going in the main app bundle where I want mine in a seperate (or many seperate) bundles Cheers

ahmedshuhel commented 7 years ago

@TimBailey-pnk Do you get any error? Your configuration looks good to me. Just check if the path is correct relative to baseURL.

TimBailey-pnk commented 7 years ago

I don't get any errors, but i don't get a bundle either. I think its because the baseURL is pointing to /src so trying to make a relative path that pops out of /src just wont work whatever I try.

EisenbergEffect commented 4 years ago

Closing this issue. The aurelia-bundler library has been superseded by the aurelia-cli.