Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

Commit

Permalink
critical for #13 + wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
iSuslov committed Oct 19, 2016
1 parent 648daa1 commit ab4d84b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ Searches for usages in:

<b>In `dom-module`</b>
<li>All web components with names that contain</li>
<li> Animations in `entry-animation` and `exit-animation` attributes</li>
<li> Animations in `entry-animation` and `exit-animation` attributes (configurable)</li>
<li> Icons in all attributes with name `icon`</li>
<li> All `include` attributes in `style` tags </li>
<li> All `effects` attributes (configurable) </li>


<b>In `Polymer({...})` initialization snippet</b>
Expand Down Expand Up @@ -191,13 +192,14 @@ You can also path two more arguments (order does not matter):
####Config file
Config file can be `.json` file with any name and any set of properties from the default configuration, which looks like this:

``` json
```
{
"rootDir": "",
"bowerFolderName": "bower_components",
"ignoredFolders": ["test", "demo"],
"ignoredComponents": [],
"animationAttributes": [
"attributes": [
"effects",
"entry-animation",
"exit-animation"
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "polymer-auto-import",
"version": "1.1.3",
"version": "1.1.4",
"description": "Check polymer files and organize all imports automatically",
"main": "polymer-imports.js",
"scripts": {
Expand Down
25 changes: 10 additions & 15 deletions polymer-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const config = {
bowerFolderName: "bower_components",
ignoredFolders: ["test", "demo"],
ignoredComponents: [],
animationAttributes: [
attributes: [
"effects",
"entry-animation",
"exit-animation"
],
Expand Down Expand Up @@ -172,7 +173,7 @@ function findOldImportsAndCreateImportsNode(d) {
findAndRemoveImports(el);
}
});
likeBreaksToRemove.forEach(function(el){
likeBreaksToRemove.forEach(function (el) {
treeAdapter.detachNode(el);
});
}
Expand Down Expand Up @@ -219,15 +220,6 @@ function collectAllWebComponentsTagNames(documentFragment, aggregatorObject) {
})
}
})
} else{
node.attrs.forEach(function (attr) {
if (attr.name === "effects" && attr.value) {
var includesArray = attr.value.split(" ");
includesArray.forEach(function (includeVal) {
aggregatorObject[config.resolve[includeVal] || includeVal] = '';
})
}
})
}

collectAllWebComponentsTagNames(node, aggregatorObject);
Expand Down Expand Up @@ -298,11 +290,14 @@ function checkAttributes(attrs, aggregatorObject) {
if (name.indexOf('-') === -1) {
name += "-icons"
}
aggregatorObject[name] = '';
aggregatorObject[config.resolve[name] || name] = '';
}
} //check animations
else if (attr.value && config.animationAttributes.indexOf(attr.name) !== -1) {
aggregatorObject[attr.value] = '';
} //check other attributes
else if (attr.value && config.attributes.indexOf(attr.name) !== -1) {
var valueArray = attr.value.split(" ");
valueArray.forEach(function (name) {
aggregatorObject[config.resolve[name] || name] = '';
});
}
})
}
Expand Down

0 comments on commit ab4d84b

Please sign in to comment.