Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
[grunt][data][configs] precompile scripts data into ES6 JS file inste…
Browse files Browse the repository at this point in the history
…ad of the JSON-file
  • Loading branch information
ArmorDarks committed Aug 5, 2019
1 parent 3d513ef commit 6031770
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
- [grunt] Ensured CSS sourcemaps to be generated when using CCSO.
- [grunt] Changed styles watcher to watch for all `*.scss` files in source and temp directories instead of only `styles` directory. That's nice addition for projects which prefer to group component's scripts and styles.
- [grunt] Updated `grunt-sass` task configuration to work with new `implementation` option.
- [grunt][data][configs] Precompile scripts data into ES6 JS file `scripts.js` instead of the JSON-file to make it tree shakable. It also makes it possible to be used directly by 3rd-party scripts, like Jest, without the need to run again whole compilation which due to Grunt massiveness can take some time.
- [templates] Renamed components and layouts Nunjucks files to not use leading `_` in names since due to changes in related Grunt task configuration it is enough to use leading `_` in directory that houses them to prevent building into standalone pages.
- [data] Made `SOCIAL.url` optional since in some cases social service might not require one.

Expand Down
9 changes: 2 additions & 7 deletions jspm.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SystemJS.config({
"github:": "/jspm_packages/github/",
"main/": "",
"serviceWorker": "serviceWorker",
"@data": "/temp/data/scripts.json"
"@data": "/temp/data/scripts.js"
}
},
nodeConfig: {
Expand All @@ -15,7 +15,7 @@ SystemJS.config({
"github:": "jspm_packages/github/",
"main/": "source/scripts/",
"serviceWorker": "source/scripts/serviceWorker",
"@data": "temp/data/scripts.json"
"@data": "temp/data/scripts.js"
}
},
devConfig: {
Expand All @@ -32,11 +32,6 @@ SystemJS.config({
}
}
},
meta: {
"@data": {
"loader": "json"
}
},
transpiler: "plugin-babel",
packages: {
"main": {
Expand Down
2 changes: 1 addition & 1 deletion source/data/scripts.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const data = require('./index')

/**
* Data to be compiled to a JSON file `scripts.json` by a Grunt task
* Data to be compiled to a JSON file `scripts.js` by a Grunt task
* Later this data can be imported in `source/scripts` via
* `import data from '@data'`
* Try to keep footprint of this file as small as possible
Expand Down
2 changes: 1 addition & 1 deletion tasks/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports = function (grunt) {
require(join(process.cwd(), this.config('file.source.data.scripts')))(grunt)
},
files: [{
dest: '<%= path.temp.data %>/scripts.json'
dest: '<%= path.temp.data %>/scripts.js'
}]
}
})
Expand Down

0 comments on commit 6031770

Please sign in to comment.