Commit e7143ccc5ae343e68978c3fcdea9954fd1915de1
1 parent
b6d52239
添加sass
Showing
7 changed files
with
51 additions
and
26 deletions
README.md
| @@ -28,3 +28,6 @@ npm test | @@ -28,3 +28,6 @@ npm test | ||
| 28 | ``` | 28 | ``` |
| 29 | 29 | ||
| 30 | For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). | 30 | For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). |
| 31 | + | ||
| 32 | +# 安装npm | ||
| 33 | + |
build/webpack.base.conf.js
| @@ -67,6 +67,10 @@ module.exports = { | @@ -67,6 +67,10 @@ module.exports = { | ||
| 67 | limit: 10000, | 67 | limit: 10000, |
| 68 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') | 68 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') |
| 69 | } | 69 | } |
| 70 | + }, | ||
| 71 | + { | ||
| 72 | + test: /\.scss$/, | ||
| 73 | + loaders: ["style", "css", "sass"] | ||
| 70 | } | 74 | } |
| 71 | ] | 75 | ] |
| 72 | } | 76 | } |
package.json
| @@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
| 14 | }, | 14 | }, |
| 15 | "dependencies": { | 15 | "dependencies": { |
| 16 | "vue": "^2.1.10", | 16 | "vue": "^2.1.10", |
| 17 | + "vue-resource": "^1.2.0", | ||
| 17 | "vue-router": "^2.2.0" | 18 | "vue-router": "^2.2.0" |
| 18 | }, | 19 | }, |
| 19 | "devDependencies": { | 20 | "devDependencies": { |
| @@ -21,19 +22,24 @@ | @@ -21,19 +22,24 @@ | ||
| 21 | "babel-core": "^6.22.1", | 22 | "babel-core": "^6.22.1", |
| 22 | "babel-eslint": "^7.1.1", | 23 | "babel-eslint": "^7.1.1", |
| 23 | "babel-loader": "^6.2.10", | 24 | "babel-loader": "^6.2.10", |
| 25 | + "babel-plugin-istanbul": "^3.1.2", | ||
| 24 | "babel-plugin-transform-runtime": "^6.22.0", | 26 | "babel-plugin-transform-runtime": "^6.22.0", |
| 25 | "babel-preset-es2015": "^6.22.0", | 27 | "babel-preset-es2015": "^6.22.0", |
| 26 | "babel-preset-stage-2": "^6.22.0", | 28 | "babel-preset-stage-2": "^6.22.0", |
| 27 | "babel-register": "^6.22.0", | 29 | "babel-register": "^6.22.0", |
| 30 | + "chai": "^3.5.0", | ||
| 28 | "chalk": "^1.1.3", | 31 | "chalk": "^1.1.3", |
| 32 | + "chromedriver": "^2.27.2", | ||
| 29 | "connect-history-api-fallback": "^1.3.0", | 33 | "connect-history-api-fallback": "^1.3.0", |
| 30 | "copy-webpack-plugin": "^4.0.1", | 34 | "copy-webpack-plugin": "^4.0.1", |
| 35 | + "cross-env": "^3.1.4", | ||
| 36 | + "cross-spawn": "^5.0.1", | ||
| 31 | "css-loader": "^0.26.1", | 37 | "css-loader": "^0.26.1", |
| 32 | "eslint": "^3.14.1", | 38 | "eslint": "^3.14.1", |
| 39 | + "eslint-config-standard": "^6.2.1", | ||
| 33 | "eslint-friendly-formatter": "^2.0.7", | 40 | "eslint-friendly-formatter": "^2.0.7", |
| 34 | "eslint-loader": "^1.6.1", | 41 | "eslint-loader": "^1.6.1", |
| 35 | "eslint-plugin-html": "^2.0.0", | 42 | "eslint-plugin-html": "^2.0.0", |
| 36 | - "eslint-config-standard": "^6.2.1", | ||
| 37 | "eslint-plugin-promise": "^3.4.0", | 43 | "eslint-plugin-promise": "^3.4.0", |
| 38 | "eslint-plugin-standard": "^2.0.1", | 44 | "eslint-plugin-standard": "^2.0.1", |
| 39 | "eventsource-polyfill": "^0.9.6", | 45 | "eventsource-polyfill": "^0.9.6", |
| @@ -44,8 +50,7 @@ | @@ -44,8 +50,7 @@ | ||
| 44 | "function-bind": "^1.1.0", | 50 | "function-bind": "^1.1.0", |
| 45 | "html-webpack-plugin": "^2.28.0", | 51 | "html-webpack-plugin": "^2.28.0", |
| 46 | "http-proxy-middleware": "^0.17.3", | 52 | "http-proxy-middleware": "^0.17.3", |
| 47 | - "webpack-bundle-analyzer": "^2.2.1", | ||
| 48 | - "cross-env": "^3.1.4", | 53 | + "inject-loader": "^2.0.1", |
| 49 | "karma": "^1.4.1", | 54 | "karma": "^1.4.1", |
| 50 | "karma-coverage": "^1.1.1", | 55 | "karma-coverage": "^1.1.1", |
| 51 | "karma-mocha": "^1.3.0", | 56 | "karma-mocha": "^1.3.0", |
| @@ -56,26 +61,24 @@ | @@ -56,26 +61,24 @@ | ||
| 56 | "karma-webpack": "^2.0.2", | 61 | "karma-webpack": "^2.0.2", |
| 57 | "lolex": "^1.5.2", | 62 | "lolex": "^1.5.2", |
| 58 | "mocha": "^3.2.0", | 63 | "mocha": "^3.2.0", |
| 59 | - "chai": "^3.5.0", | ||
| 60 | - "sinon": "^1.17.7", | ||
| 61 | - "sinon-chai": "^2.8.0", | ||
| 62 | - "inject-loader": "^2.0.1", | ||
| 63 | - "babel-plugin-istanbul": "^3.1.2", | ||
| 64 | - "phantomjs-prebuilt": "^2.1.14", | ||
| 65 | - "chromedriver": "^2.27.2", | ||
| 66 | - "cross-spawn": "^5.0.1", | ||
| 67 | "nightwatch": "^0.9.12", | 64 | "nightwatch": "^0.9.12", |
| 68 | - "selenium-server": "^3.0.1", | ||
| 69 | - "semver": "^5.3.0", | 65 | + "node-sass": "^4.5.0", |
| 70 | "opn": "^4.0.2", | 66 | "opn": "^4.0.2", |
| 71 | "optimize-css-assets-webpack-plugin": "^1.3.0", | 67 | "optimize-css-assets-webpack-plugin": "^1.3.0", |
| 72 | "ora": "^1.1.0", | 68 | "ora": "^1.1.0", |
| 69 | + "phantomjs-prebuilt": "^2.1.14", | ||
| 73 | "rimraf": "^2.6.0", | 70 | "rimraf": "^2.6.0", |
| 71 | + "sass-loader": "^6.0.2", | ||
| 72 | + "selenium-server": "^3.0.1", | ||
| 73 | + "semver": "^5.3.0", | ||
| 74 | + "sinon": "^1.17.7", | ||
| 75 | + "sinon-chai": "^2.8.0", | ||
| 74 | "url-loader": "^0.5.7", | 76 | "url-loader": "^0.5.7", |
| 75 | "vue-loader": "^11.0.0", | 77 | "vue-loader": "^11.0.0", |
| 76 | "vue-style-loader": "^2.0.0", | 78 | "vue-style-loader": "^2.0.0", |
| 77 | "vue-template-compiler": "^2.1.10", | 79 | "vue-template-compiler": "^2.1.10", |
| 78 | "webpack": "^2.2.1", | 80 | "webpack": "^2.2.1", |
| 81 | + "webpack-bundle-analyzer": "^2.2.1", | ||
| 79 | "webpack-dev-middleware": "^1.10.0", | 82 | "webpack-dev-middleware": "^1.10.0", |
| 80 | "webpack-hot-middleware": "^2.16.1", | 83 | "webpack-hot-middleware": "^2.16.1", |
| 81 | "webpack-merge": "^2.6.1" | 84 | "webpack-merge": "^2.6.1" |
src/App.vue
| @@ -11,13 +11,15 @@ export default { | @@ -11,13 +11,15 @@ export default { | ||
| 11 | } | 11 | } |
| 12 | </script> | 12 | </script> |
| 13 | 13 | ||
| 14 | -<style> | ||
| 15 | -#app { | ||
| 16 | - font-family: 'Avenir', Helvetica, Arial, sans-serif; | ||
| 17 | - -webkit-font-smoothing: antialiased; | ||
| 18 | - -moz-osx-font-smoothing: grayscale; | ||
| 19 | - text-align: center; | ||
| 20 | - color: #2c3e50; | ||
| 21 | - margin-top: 60px; | ||
| 22 | -} | 14 | +<style lang="scss"> |
| 15 | + @import 'common/style/main'; | ||
| 16 | + | ||
| 17 | + #app{ | ||
| 18 | + font-family: 'Avenir', Helvetica, Arial, sans-serif; | ||
| 19 | + -webkit-font-smoothing: antialiased; | ||
| 20 | + -moz-osx-font-smoothing: grayscale; | ||
| 21 | + text-align: center; | ||
| 22 | + color: #2c3e50; | ||
| 23 | + margin-top: 60px; | ||
| 24 | + } | ||
| 23 | </style> | 25 | </style> |
src/common/style/main.scss
0 → 100644
src/components/index.vue
| @@ -23,8 +23,9 @@ export default { | @@ -23,8 +23,9 @@ export default { | ||
| 23 | </script> | 23 | </script> |
| 24 | 24 | ||
| 25 | <!-- Add "scoped" attribute to limit CSS to this component only --> | 25 | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| 26 | -<style scoped> | ||
| 27 | -h1, h2 { | ||
| 28 | - font-weight: normal; | ||
| 29 | -} | 26 | +<style lang="scss" scoped> |
| 27 | + h1{ | ||
| 28 | + font-size: 48px; | ||
| 29 | + } | ||
| 30 | + | ||
| 30 | </style> | 31 | </style> |