Add assets task

This commit is contained in:
Tom Raithel
2017-02-10 19:54:26 +01:00
parent 0673da6867
commit d331e97ba8
4 changed files with 19 additions and 0 deletions

View File

@@ -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
View 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");
});

View File

@@ -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)
); );

View File

@@ -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'));