Skip to content

Commit

Permalink
chore: Use gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
hezhii committed Aug 21, 2018
1 parent cd2e217 commit 0e260d2
Show file tree
Hide file tree
Showing 5 changed files with 794 additions and 19 deletions.
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -57,7 +57,6 @@ Now you can edit `/src` files, which will be compiled to `/assets` automatically
```bash
$ cd poppy
$ yarn build
$ yarn zip
```

This command will packages the theme files into `dist/poppy.zip`, which you can then upload to your site.
Expand Down
1 change: 0 additions & 1 deletion README.zh-CN.md
Expand Up @@ -57,7 +57,6 @@ $ yarn dev
```bash
$ cd poppy
$ yarn build
$ yarn zip
```

这个命令会把主题打包到 `dist/poppy.zip` 中,然后我们可以在 Ghost 后台直接上传压缩包以安装主题。
Expand Down
38 changes: 38 additions & 0 deletions gulpfile.js
@@ -0,0 +1,38 @@
const gulp = require('gulp');
const webpack = require('webpack');
const zip = require('gulp-zip');

const webpackConfig = require('./build/webpack.prod');

gulp.task('webpack', (callback) => {
webpack(webpackConfig, (err, stats) => {
if (err) {
throw err;
}
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false,
}) + '\n\n');

callback();
});
});

gulp.task('zip', ['webpack'], () => {
const packageJson = require('./package.json');
const filename = `${packageJson.name}-${packageJson.version}.zip`;

return gulp.src([
'**',
'!node_modules', '!node_modules/**',
'!dist', '!dist/**',
'!build', '!build/**',
'!src', '!src/**',
'!yarn.lock',
])
.pipe(zip(filename))
.pipe(gulp.dest('dist'));
});
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -7,7 +7,7 @@
},
"scripts": {
"dev": "webpack --config build/webpack.dev.js --watch",
"build": "webpack --config build/webpack.prod.js"
"build": "gulp zip"
},
"license": "MIT",
"author": {
Expand Down Expand Up @@ -49,6 +49,8 @@
"clean-webpack-plugin": "^0.1.19",
"css-loader": "^1.0.0",
"file-loader": "^1.1.11",
"gulp": "^3.9.1",
"gulp-zip": "^4.2.0",
"mini-css-extract-plugin": "^0.4.1",
"node-sass": "^4.9.3",
"optimize-css-assets-webpack-plugin": "^5.0.0",
Expand Down

0 comments on commit 0e260d2

Please sign in to comment.