Add assets task
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
"build:pages": "babel-node ./tasks/build.js",
|
||||
"build:js": "webpack --config webpack.config.js",
|
||||
"build:css": "postcss -c postcss.config.json -o dist/styles.css styles/main.css",
|
||||
"build:assets": "babel-node ./tasks/assets.js",
|
||||
"watch": "babel-node ./tasks/watch.js",
|
||||
"clean": "babel-node ./tasks/clean.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
|
||||
12
tasks/assets.js
Normal file
12
tasks/assets.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import { copy } from 'fs-extra';
|
||||
import {
|
||||
assetsPath,
|
||||
distPath,
|
||||
} from './file';
|
||||
|
||||
copy(assetsPath(), distPath('assets'), (err) => {
|
||||
if (err) {
|
||||
return console.error(err);
|
||||
}
|
||||
console.log("copied assets");
|
||||
});
|
||||
@@ -21,6 +21,10 @@ export const stylesPath = (...pathInSrc) => (
|
||||
relativePath('styles', ...pathInSrc)
|
||||
);
|
||||
|
||||
export const assetsPath = (...pathInSrc) => (
|
||||
relativePath('assets', ...pathInSrc)
|
||||
);
|
||||
|
||||
export const jsPath = (...pathInSrc) => (
|
||||
relativePath('js', ...pathInSrc)
|
||||
);
|
||||
|
||||
@@ -3,6 +3,7 @@ import { exec } from 'child_process';
|
||||
|
||||
import {
|
||||
stylesPath,
|
||||
assetsPath,
|
||||
jsPath,
|
||||
radarPath,
|
||||
staticPath,
|
||||
@@ -26,6 +27,7 @@ const options = {
|
||||
|
||||
watch(stylesPath(), options, watchBuild('css'));
|
||||
watch(jsPath(), options, watchBuild('js'));
|
||||
watch(assetsPath(), options, watchBuild('assets'));
|
||||
watch(radarPath(), options, watchBuild('pages'));
|
||||
watch(staticPath(), options, watchBuild('pages'));
|
||||
watch(templatesPath(), options, watchBuild('pages'));
|
||||
|
||||
Reference in New Issue
Block a user