Skip to content
This repository was archived by the owner on Jun 26, 2022. It is now read-only.

Commit 4ec4148

Browse files
committed
will write the theme gen script
1 parent 3e37382 commit 4ec4148

File tree

5 files changed

+23
-18
lines changed

5 files changed

+23
-18
lines changed

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"js-yaml": "3.8.4",
5050
"marked": "0.3.6",
5151
"mkdirp": "0.5.1",
52+
"ncp": "2.0.0",
5253
"node-sass": "4.5.3",
5354
"npm-run-all": "4.0.2",
5455
"nunjucks": "3.0.0",

Diff for: scripts/newtheme.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
process.env.NODE_ENV = 'production';
2+
3+
const init = require('./init.js');
4+
const chalk = require('chalk');
5+
const {bc} = init.init();
6+
const log = console.log.bind(console,'> ');
7+
8+
const exec = require('child_process').exec;
9+

Diff for: scripts/push.js

+6
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,24 @@ const callback = (err) => {
1717
if(bc.meta.userpage){
1818

1919
let subtreecommand = `git subtree split --prefix dist`;
20+
// same commit message for every commit
2021
let commitmessage = `blog updates`;
2122

23+
// remove this line after removing dist from gitignore
2224
exec(`git add --force dist`);
2325
exec(`git commit -m '${commitmessage}'`);
26+
2427
exec(`git push https://github.com/${bc.username}/${bc.username}.github.io.git \`${subtreecommand}\`:master --force`, callback);
2528

2629
} else {
2730

31+
// else clause: this is a repopage blog
32+
2833
let subtreecommand = `git subtree push --prefix dist`;
2934
let commitmessage = `blog updates`;
3035

3136
exec(`git add --force dist`);
3237
exec(`git commit -m '${commitmessage}'`);
38+
3339
exec(`${subtreecommand} origin gh-pages`, callback);
3440
}

Diff for: webpack.dev.js

+7-11
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@ const bc = yaml.safeLoad(fs.readFileSync(path.join('_config.yml'), 'utf8'));
88
const THEME_DIR = path.join(__dirname,'themes',bc.meta.blog_theme)
99

1010
// plugin inits
11-
const extractSass = new ExtractTextPlugin({
11+
12+
// to extract css out of javascript
13+
const extractCss = new ExtractTextPlugin({
1214
filename: "[name].css"
1315
});
1416

17+
// to ignore the unicode table(2mb) for unicode slug
1518
const ignorePlugin = new webpack.IgnorePlugin(/unicode\/category\/So/);
1619

17-
// common chunks is not working most probably, have to check
18-
const commonChunkOptimize = new webpack.optimize.CommonsChunkPlugin({
19-
name: 'common',
20-
filename: 'bundle.common.js',
21-
chunks: []
22-
});
2320
// end plugin inits
2421

2522

@@ -49,7 +46,7 @@ module.exports = {
4946
},
5047
{
5148
test: /\.(scss|sass)$/,
52-
use: extractSass.extract({
49+
use: extractCss.extract({
5350
use: [{
5451
loader: "css-loader"
5552
},
@@ -64,7 +61,7 @@ module.exports = {
6461
},
6562
{
6663
test: /\.css$/,
67-
use: extractSass.extract({
64+
use: extractCss.extract({
6865
use:
6966
[
7067
{loader:'css-loader'}
@@ -104,8 +101,7 @@ module.exports = {
104101
},
105102
plugins: [
106103
ignorePlugin,
107-
commonChunkOptimize,
108-
extractSass
104+
extractCss
109105
]
110106

111107
}

Diff for: webpack.prod.js

-7
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ const extractSass = new ExtractTextPlugin({
1414

1515
const ignorePlugin = new webpack.IgnorePlugin(/unicode\/category\/So/);
1616

17-
const commonChunkOptimize = new webpack.optimize.CommonsChunkPlugin({
18-
name: 'common',
19-
filename: 'bundle.common.js',
20-
chunks: []
21-
});
22-
2317
const uglify = new webpack.optimize.UglifyJsPlugin({
2418
compress: {
2519
warnings: false,
@@ -110,7 +104,6 @@ module.exports = {
110104
},
111105
plugins: [
112106
ignorePlugin,
113-
commonChunkOptimize,
114107
extractSass,
115108
uglify
116109
]

0 commit comments

Comments
 (0)