Skip to content

Commit

Permalink
⚡️ bundle assets by rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
shen-yu committed May 29, 2021
1 parent aad79d1 commit e76f208
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
5 changes: 0 additions & 5 deletions .postcssrc

This file was deleted.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "1.8.23",
"description": "a clean and elegant theme for hexo.",
"scripts": {
"dev": "parcel serve source-src/main.js -d source/dist",
"build": "rimraf source/dist && parcel build source-src/main.js -d source/dist --no-source-maps",
"dev": "rollup -c -w",
"build": "rollup -c",
"postinstall": "node ./move_config.js",
"test": "stylint source-src/css/style.styl -c .stylintrc"
},
Expand All @@ -28,9 +28,9 @@
"homepage": "https://shen-yu.gitee.io/",
"devDependencies": {
"autoprefixer": "^9.8.6",
"cssnano": "^4.1.10",
"parcel-bundler": "^1.12.5",
"postcss-modules": "^1.5.0",
"rollup": "^2.50.2",
"rollup-plugin-styles": "^3.14.1",
"rollup-plugin-terser": "^7.0.2",
"stylint": "^2.0.0"
}
}
16 changes: 16 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import autoprefixer from "autoprefixer";
import styles from "rollup-plugin-styles";
import { terser } from "rollup-plugin-terser";

export default {
input: "source-src/main.js",
output: {
dir: "source/dist",
format: "iife",
assetFileNames: "[name][extname]",
},
plugins: [
styles({ mode: "extract", minimize: true, plugins: [autoprefixer()] }),
terser(),
],
};
6 changes: 3 additions & 3 deletions source-src/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import './css/style.styl'
import './js/ayer'
import './js/share'
import "./css/style.styl";
import "./js/ayer";
import "./js/share";
10 changes: 1 addition & 9 deletions source/dist/main.js

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

0 comments on commit e76f208

Please sign in to comment.