Skip to content

Commit

Permalink
feat: include scripts in webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmaRamirez committed Dec 25, 2017
1 parent b640bf9 commit 3d17b59
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"stylus-loader": "^3.0.1",
"tslint": "^5.8.0",
"tslint-microsoft-contrib": "^5.0.1",
"webpack": "^3.10.0"
"webpack": "^3.10.0",
"webpack-shell-plugin": "^0.5.0"
},
"devDependencies": {
"typescript": "^2.6.2",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ marked.setOptions({
});

const convertToMarkdown = (data, file) => fs.writeFile(`../public/posts/${file.split('.')[0]}.html`, (marked(data)), err => {
if (err) throw err;
if (err) console.error(err);
console.log(`Converted ${file} to hml`);
});
6 changes: 5 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const webpack = require('webpack');
const path = require('path');
const copyWebpackPlugin = require('copy-webpack-plugin');
const shellWebpackPlugin = require('webpack-shell-plugin');

module.exports = {
entry: './src/index.ts',
Expand Down Expand Up @@ -31,6 +32,9 @@ module.exports = {
from: './src/index.html',
to: './public/index.html'
}]
)
),
new shellWebpackPlugin({
onBuildStart: ['node ./scripts/build']
})
]
}

0 comments on commit 3d17b59

Please sign in to comment.