broccoli-css-modules
Advanced tools
Comparing version 0.3.4 to 0.3.5
19
index.js
@@ -93,4 +93,5 @@ 'use strict'; | ||
CSSModules.prototype.loadPath = function(absolutePath) { | ||
CSSModules.prototype.loadPath = function(dependency) { | ||
var seen = this._seen; | ||
var absolutePath = dependency.toString(); | ||
if (seen[absolutePath]) { | ||
@@ -101,3 +102,3 @@ return Promise.resolve(seen[absolutePath]); | ||
var content = fs.readFileSync(absolutePath, this.encoding); | ||
return this.load(content, absolutePath, this.fetchExports.bind(this)).then(function(result) { | ||
return this.load(content, dependency, this.fetchExports.bind(this)).then(function(result) { | ||
return (seen[absolutePath] = result); | ||
@@ -107,13 +108,13 @@ }); | ||
CSSModules.prototype.generateRelativeScopedName = function(className, absolutePath, fullRule) { | ||
CSSModules.prototype.generateRelativeScopedName = function(dependency, className, absolutePath, fullRule) { | ||
var relativePath = absolutePath.replace(this.inputPaths[0] + '/', ''); | ||
return this.generateScopedName(className, relativePath, fullRule); | ||
return this.generateScopedName(className, relativePath, fullRule, dependency); | ||
}; | ||
CSSModules.prototype.load = function(content, contentPath, pathFetcher) { | ||
CSSModules.prototype.load = function(content, dependency, pathFetcher) { | ||
var parser = new ModulesParser(pathFetcher); | ||
var options = this.processorOptions({ from: '/' + contentPath }); | ||
var options = this.processorOptions({ from: '/' + dependency }); | ||
var processor = postcss([] | ||
.concat(this.plugins.before) | ||
.concat(this.loaderPlugins()) | ||
.concat(this.loaderPlugins(dependency)) | ||
.concat([parser.plugin]) | ||
@@ -131,3 +132,3 @@ .concat(this.plugins.after)); | ||
CSSModules.prototype.loaderPlugins = function() { | ||
CSSModules.prototype.loaderPlugins = function(dependency) { | ||
return [ | ||
@@ -139,3 +140,3 @@ LoaderCore.values, | ||
LoaderCore.scope({ | ||
generateScopedName: this.generateRelativeScopedName.bind(this) | ||
generateScopedName: this.generateRelativeScopedName.bind(this, dependency) | ||
}) | ||
@@ -142,0 +143,0 @@ ]; |
{ | ||
"name": "broccoli-css-modules", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "A broccoli plugin for compiling CSS modules", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9639
136