Permalink
Browse files

First working version of the loader.

  • Loading branch information...
1 parent 5baf1fe commit fa176b6c6ddf457582a5ff6b0d58aa0374e56346 @okonet committed May 13, 2014
Showing with 57 additions and 0 deletions.
  1. +28 −0 index.js
  2. +29 −0 package.json
View
@@ -0,0 +1,28 @@
+/*
+ MIT License http://www.opensource.org/licenses/mit-license.php
+ Author: Andrey Okonetchnikov @okonetchnikov
+*/
+
+var utils = require('loader-utils');
+var rework = require('rework');
+var path = require('path');
+
+module.exports = function(content) {
+ this.cacheable && this.cacheable();
+
+ var options = utils.parseQuery(this.query);
+ var css = rework(content);
+ var rework_options = this.options.rework;
+
+ if(rework_options && rework_options.use) {
+ rework_options.use.forEach(function(plugin){
+ if(typeof plugin === 'function') {
+ css.use(plugin);
+ } else {
+ throw new Error("Plugin should be a function");
+ }
+ });
+ }
+
+ return css.toString(options);
+};
View
@@ -0,0 +1,29 @@
+{
+ "name": "rework-loader",
+ "version": "0.0.0",
+ "description": "rework loader for webpack",
+ "main": "index.js",
+ "scripts": {
+ "test": "mocha -u tdd -R spec"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/okonet/rework-loader.git"
+ },
+ "keywords": [
+ "rework",
+ "css",
+ "webpack",
+ "loader"
+ ],
+ "author": "Andrey Okonetchnikov <andrey@okonet.ru>",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/okonet/rework-loader/issues"
+ },
+ "homepage": "https://github.com/okonet/rework-loader",
+ "dependencies": {
+ "rework": "^0.20.3",
+ "loader-utils": "^0.2.2"
+ }
+}

0 comments on commit fa176b6

Please sign in to comment.