mirror of
https://github.com/locomotivemtl/locomotive-boilerplate.git
synced 2026-01-15 00:55:08 +08:00
Refactor build utilities
Separated generic functions from build helpers. Changed: - Moved 'utils/*.js' to 'helpers/*.js' - From 'utils/config.js': - Moved function `merge` to 'utils/index.js'. - Moved function `isObjectLike` to 'utils/index.js'. - From 'utils/template.js': - Moved function `flatten` to 'utils/index.js'. - Moved function `escapeRegExp` to 'utils/index.js'. - From 'tasks/styles.js': - Moved function `createPostCSSProcessor` to 'helpers/postcss.js' as `createProcessor`. - Replaced function `Object.assign` with `merge` for task options parsing in all tasks.
This commit is contained in:
19
build/helpers/config.js
Normal file
19
build/helpers/config.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @file Provides simple user configuration options.
|
||||
*/
|
||||
|
||||
import loconfig from '../../loconfig.json' assert { type: 'json' };
|
||||
import { merge } from '../utils/index.js';
|
||||
|
||||
try {
|
||||
const usrconfig = await import('../../loconfig.local.json', {
|
||||
assert: { type: "json" },
|
||||
});
|
||||
usrconfig = usrconfig.default;
|
||||
|
||||
merge(loconfig, usrconfig);
|
||||
} catch (err) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
export default loconfig;
|
||||
Reference in New Issue
Block a user