broccoli-css-lang-optimizer
Advanced tools
Comparing version 1.0.0 to 1.1.0
/* Copyright 2016 LinkedIn Corp. Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy of | ||
* the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
@@ -6,0 +6,0 @@ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, |
/* Copyright 2016 LinkedIn Corp. Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy of | ||
* the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
@@ -6,0 +6,0 @@ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, |
/* Copyright 2016 LinkedIn Corp. Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy of | ||
* the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
@@ -15,2 +15,3 @@ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
var langOptimizer = require("postcss-lang-optimizer"); | ||
var rtlcss = require("rtlcss"); | ||
@@ -32,3 +33,2 @@ function LangOptimizer(inputNode, options) { | ||
}; | ||
PostCSSFilter.call(this, inputNode, postCSSOptions); | ||
@@ -65,3 +65,10 @@ } | ||
} | ||
addOutputFile(langCSS, langFilename); | ||
if (options.rtlLangs && options.rtlLangs.indexOf(lang) >= 0) { | ||
rtlcss(options.rtlOptions).process(langCSS).then(function(result) { | ||
addOutputFile(result.css, langFilename); | ||
}); | ||
} else { | ||
addOutputFile(langCSS, langFilename); | ||
} | ||
}); | ||
@@ -68,0 +75,0 @@ }; |
{ | ||
"name": "broccoli-css-lang-optimizer", | ||
"description": "Extract Lang-specific CSS rulesets to lang-specific files.", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"author": "Chris Eppstein <chris@eppsteins.net>", | ||
@@ -22,3 +22,4 @@ "main": "lib/langOptimizer.js", | ||
"broccoli-postcss-sourcemaps": "^2.2.0-sourcemaps.0", | ||
"postcss-lang-optimizer": "^1.1.0" | ||
"postcss-lang-optimizer": "^1.1.0", | ||
"rtlcss": "^1.7.3" | ||
}, | ||
@@ -25,0 +26,0 @@ "devDependencies": { |
@@ -42,5 +42,10 @@ # broccoli-css-lang-optimizer | ||
// This property can also be set to a function that returns an array of langs. | ||
langs: ["en", "de", "zh"] | ||
langs: ["en", "de", "zh"], | ||
// The folowing langs will be RTL processed with rtlcss. Highly | ||
// recommend not setting `includeBaseFile` to `false` when using rtl flipping. | ||
rtlLangs: ["ar", "he"], | ||
// The following options will be passed to the rtlcss plugin: | ||
rtlOptions: { } | ||
} | ||
``` | ||
/* Copyright 2016 LinkedIn Corp. Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy of | ||
* the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
@@ -133,2 +133,16 @@ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
}); | ||
it("flips rtl langs", function (done) { | ||
var optimizer = LangOptimizer(fixtureSourceDir("rtlLangs"), { | ||
rtlLangs: ["ar"] | ||
}); | ||
var builder = new broccoli.Builder(optimizer); | ||
build(builder) | ||
.then(function(outputDir) { | ||
diffDirs(outputDir, fixtureOutputDir("rtlLangs"), function() { | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
24943
349
1564
51
3
+ Addedrtlcss@^1.7.3
+ Addedcolors@0.6.2(transitive)
+ Addedcommander@2.1.0(transitive)
+ Addedfindup@0.1.5(transitive)
+ Addedrtlcss@1.7.4(transitive)
+ Addedstrip-json-comments@1.0.4(transitive)