mirror of
https://github.com/locomotivemtl/locomotive-boilerplate.git
synced 2026-01-15 00:55:08 +08:00
Where data is defined under a `data` field in 'loconfig.json'.
Example:
```json5
{
"paths": {…},
"data": {
"foo": "b"
},
"tasks": {
"concats": [
{
"includes": [
"{% paths.scripts.src %}/vendors/*.js"
],
"outfile": "{% paths.scripts.dest %}/a{% foo %}c.js"
}
]
}
}
```
30 lines
578 B
JavaScript
30 lines
578 B
JavaScript
/**
|
|
* @file Provides simple user configuration options.
|
|
*/
|
|
|
|
import loconfig from '../../loconfig.json' assert { type: 'json' };
|
|
import { merge } from '../utils/index.js';
|
|
|
|
let usrconfig;
|
|
|
|
try {
|
|
usrconfig = await import('../../loconfig.local.json', {
|
|
assert: { type: 'json' },
|
|
});
|
|
usrconfig = usrconfig.default;
|
|
|
|
merge(loconfig, usrconfig);
|
|
} catch (err) {
|
|
// do nothing
|
|
}
|
|
|
|
loconfig.data = (loconfig.data ?? {});
|
|
loconfig.paths = (loconfig.paths ?? {});
|
|
loconfig.tasks = (loconfig.tasks ?? {});
|
|
|
|
export default loconfig;
|
|
|
|
export {
|
|
loconfig,
|
|
};
|