Add assets task
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
"build:pages": "babel-node ./tasks/build.js",
|
"build:pages": "babel-node ./tasks/build.js",
|
||||||
"build:js": "webpack --config webpack.config.js",
|
"build:js": "webpack --config webpack.config.js",
|
||||||
"build:css": "postcss -c postcss.config.json -o dist/styles.css styles/main.css",
|
"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",
|
"watch": "babel-node ./tasks/watch.js",
|
||||||
"clean": "babel-node ./tasks/clean.js",
|
"clean": "babel-node ./tasks/clean.js",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"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)
|
relativePath('styles', ...pathInSrc)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const assetsPath = (...pathInSrc) => (
|
||||||
|
relativePath('assets', ...pathInSrc)
|
||||||
|
);
|
||||||
|
|
||||||
export const jsPath = (...pathInSrc) => (
|
export const jsPath = (...pathInSrc) => (
|
||||||
relativePath('js', ...pathInSrc)
|
relativePath('js', ...pathInSrc)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { exec } from 'child_process';
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
stylesPath,
|
stylesPath,
|
||||||
|
assetsPath,
|
||||||
jsPath,
|
jsPath,
|
||||||
radarPath,
|
radarPath,
|
||||||
staticPath,
|
staticPath,
|
||||||
@@ -26,6 +27,7 @@ const options = {
|
|||||||
|
|
||||||
watch(stylesPath(), options, watchBuild('css'));
|
watch(stylesPath(), options, watchBuild('css'));
|
||||||
watch(jsPath(), options, watchBuild('js'));
|
watch(jsPath(), options, watchBuild('js'));
|
||||||
|
watch(assetsPath(), options, watchBuild('assets'));
|
||||||
watch(radarPath(), options, watchBuild('pages'));
|
watch(radarPath(), options, watchBuild('pages'));
|
||||||
watch(staticPath(), options, watchBuild('pages'));
|
watch(staticPath(), options, watchBuild('pages'));
|
||||||
watch(templatesPath(), options, watchBuild('pages'));
|
watch(templatesPath(), options, watchBuild('pages'));
|
||||||
|
|||||||
Reference in New Issue
Block a user