Skip to content

Commit 6b31165

Browse files
committed
fixed the source function issue
1 parent f13e6ce commit 6b31165

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
## PostCss Wrapper Loader
1+
## PostCss Wrapper Loader for Webpack
2+
23
### Example
34
This plugin wraps all the cssClasses in a css file with a prefix class while webpack bundled. It helps to scope a specific css file with a prefix class
45

@@ -18,7 +19,7 @@ In the webpack config file initialize the loader
1819
const PostCssWrapper = require('postcss-wrapper-loader');
1920
```
2021

21-
then within your webpack plugins:
22+
add this plugin in webpack plugins
2223
```
2324
plugins: [
2425
new ExtractTextWebpackPlugin('styles.css'),

index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ PostCssWrapper.prototype.apply = function(compiler) {
3535
const source = assets[file].source();
3636
const processor = postCss([postCssWrapperPlugin(container)]);
3737

38-
processor.process(source).then(function(result){
38+
processor.process(source).then(function(result) {
3939
compilation.assets[file] = {
40-
source: result.css,
41-
size: result.css.length
40+
source: function() { return result.css; },
41+
size: function() { return result.css.length; }
4242
};
4343
callback();
4444
}, callback);

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcss-wrapper-loader",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"private": false,
55
"description": "This plugin wraps all the cssClasses in a css file with a prefix class while webpack bundled. It helps to scope a specific css file with a prefix class",
66
"main": "index.js",

0 commit comments

Comments
 (0)