Permalink
Browse files

PostCSS

  • Loading branch information...
cazala committed Aug 7, 2016
1 parent faf2789 commit 3891271b84fc3814ef02f19f1a76e765b326526f
Showing with 29 additions and 7 deletions.
  1. +2 −0 index.html
  2. +9 −0 package.json
  3. +3 −0 src/index.css
  4. +3 −5 src/index.js
  5. +12 −2 webpack.config.js
@@ -0,0 +1,2 @@
<script src='./dist/bundle.js'></script>
<body>Hello World</body>
@@ -16,6 +16,7 @@
"author": "Juan Cazala",
"license": "MIT",
"devDependencies": {
"autoprefixer": "^6.4.0",
"babel-core": "^6.13.2",
"babel-loader": "^6.2.4",
"babel-plugin-jsx-display-if": "^3.0.0",
@@ -25,6 +26,14 @@
"babel-preset-react": "^6.11.1",
"babel-register": "^6.11.6",
"babel-runtime": "^6.11.6",
"css-loader": "^0.23.1",
"postcss-import": "^8.1.2",
"postcss-loader": "^0.9.1",
"postcss-mixins": "^5.0.0",
"postcss-nested": "^1.0.0",
"postcss-simple-vars": "^3.0.0",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"webpack": "^1.13.1"
}
}
@@ -0,0 +1,3 @@
.red {
color: red;
}
@@ -1,5 +1,3 @@
const obj = { a: 1, b:2, c:3 }
const { a, ...rest } = obj
const spread = { ...rest, d: 4 }
console.log(rest) // { b:2, c: 3}
console.log(spread) // { b:2, c: 3, d: 4 }
import styles from './index.css'
console.log(styles) // { red: '...' }
window.onload = () => document.body.classList.add(styles.red)
@@ -9,7 +9,7 @@ module.exports = {
},
plugins: [ new webpack.NoErrorsPlugin() ],
resolve: {
extensions: ['', '.js', '.json'],
extensions: ['', '.js', '.json', '.css', 'scss'],
modulesDirectories: ['.', 'src', 'node_modules']
},
module: {
@@ -18,7 +18,17 @@ module.exports = {
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/
},
{
test: /(\.scss|\.css)$/,
loaders: ['style', 'css?sourceMap&modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]', 'postcss']
}
]
}
},
postcss: [
require('autoprefixer'),
require('postcss-import'),
require('postcss-nested'),
require('postcss-simple-vars')
]
}

0 comments on commit 3891271

Please sign in to comment.