Comparing version 0.2.10 to 0.3.0
@@ -56,2 +56,5 @@ /*(MIT License) | ||
CssTreeWalker.prototype.readRules = function (rules) { | ||
console.log('RULES'); | ||
console.log(JSON.stringify(rules)); | ||
rules.forEach(function (rule) { | ||
@@ -83,3 +86,3 @@ | ||
rules.forEach(function (rule) { | ||
@@ -86,0 +89,0 @@ var ruleType = rule.type; |
{ | ||
"name": "shakecss", | ||
"version": "0.2.10", | ||
"description": "Special thanks to the makers of purifycss. Modified version of purifycss that better works together with Angular2-Applications. Takes a stylesheet + a bundled js (e.g. packed angular2-application) and removes any unused style-selectors from the .css. This is something Webpack /Angular-CLI does not do when optimizing your code. You have to use e.g. ExtractText Webpack-Plugin to prevent your .css being inlined into to the .js-bundle.", | ||
"version": "0.3.0", | ||
"description": "Special thanks to the makers of purifycss. Modified version of purifycss that better works together with Angular2 applications. Takes a stylesheet + a bundled js-file (e.g. packed angular2-application) and removes any unused !class-selectors! from the .css. It will not remove selectors like html{} or ul{}, only class selectors. This is something Webpack /Angular-CLI does not do when optimizing your code. You have to use e.g. ExtractText Webpack-Plugin to prevent your .css being inlined into to the .js-bundle first.", | ||
"main": "shakecss.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -16,3 +16,3 @@ Install with `npm install shake-css`, or just drop css-shaker.js somewhere. | ||
You can have multiple chunks (lazy loading, Angular2) | ||
but currently only once .css file. | ||
but *currently* only one .css file. | ||
@@ -26,3 +26,8 @@ This plugin will not remove any unused inline-css (css merged into the .js bundle) | ||
## API | ||
e.g. in package.json script: | ||
`shakeCss(<distribution-path>)` | ||
`npm run shakeCss <distribution-path>` | ||
Example: | ||
`optimizeCss: "npm run shakeCss dist/"` |
/* | ||
(MIT License) | ||
(MIT License) | ||
Copyright (c) 2016 Kenny Tran, Matthew Rourke, Phoebe Li | ||
Copyright (c) 2016 Kenny Tran, Matthew Rourke, Phoebe Li | ||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE.*/ | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE.*/ | ||
var getAllWordsInSelector = require('./utils/ExtractWordsUtil').getAllWordsInSelector; | ||
@@ -61,3 +61,3 @@ | ||
this.wildcardWhitelist.push( | ||
whitelistSelector.substr(1, whitelistSelector.length - 2) | ||
whitelistSelector.substr(1, whitelistSelector.length - 2) | ||
); | ||
@@ -90,5 +90,7 @@ } else { | ||
var usedWords = words.filter(function (word) { | ||
return contentWords[word]; | ||
return contentWords[word] || !word.match(/\..+?/g); | ||
}); | ||
if (usedWords.length === words.length) { | ||
@@ -95,0 +97,0 @@ usedSelectors.push(selector); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
165715
695
32