From 38116f9d6d68c3a7dcdc624449f3faf1a297560e Mon Sep 17 00:00:00 2001 From: David Clark Date: Sat, 23 May 2015 21:14:01 -0700 Subject: [PATCH] Webpack test --- package.json | 6 +++++- webpack-entry.js | 3 +++ webpack.config.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 webpack-entry.js create mode 100644 webpack.config.js diff --git a/package.json b/package.json index 4fd8117..e2fc8f0 100644 --- a/package.json +++ b/package.json @@ -23,9 +23,13 @@ }, "homepage": "https://github.com/davidtheclark/postcss-log-warnings", "devDependencies": { + "css-loader": "0.14.0", "eslint": "0.20.0", "lodash": "3.8.0", - "tape": "4.0.0" + "postcss-loader": "0.4.3", + "style-loader": "0.12.2", + "tape": "4.0.0", + "webpack": "1.9.8" }, "dependencies": { "chalk": "^1.0.0", diff --git a/webpack-entry.js b/webpack-entry.js new file mode 100644 index 0000000..c8977cd --- /dev/null +++ b/webpack-entry.js @@ -0,0 +1,3 @@ +var css = require('./test/forVisual.css'); + +console.log(css); diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..64ca40f --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,28 @@ +'use strict'; + +var logWarnings = require('./index.js'); +var postcss = require('postcss'); + +var rejectColors = postcss.plugin('reject-colors', function() { + return function(css, result) { + css.eachDecl(function(decl) { + if (decl.prop === 'color') { + result.warn('no colors allowed', { node: decl }); + } + }); + }; +}); + +module.exports = { + module: { + loaders: [{ + test: /\.css$/, + loader: 'style-loader!css-loader!postcss-loader' + }] + }, + postcss: [rejectColors(), logWarnings({ throwError: true })], + entry: './webpack-entry.js', + output: { + filename: 'tmp/output.js' + } +};