diff --git a/README.md b/README.md
index 01330ff..971c750 100644
--- a/README.md
+++ b/README.md
@@ -10,9 +10,10 @@ Searches for usages in:
In `dom-module`
All web components with names that contain
- Animations in `entry-animation` and `exit-animation` attributes
+ Animations in `entry-animation` and `exit-animation` attributes (configurable)
Icons in all attributes with name `icon`
All `include` attributes in `style` tags
+ All `effects` attributes (configurable)
In `Polymer({...})` initialization snippet
@@ -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"
],
diff --git a/package.json b/package.json
index 9a5511b..bcd1fb3 100644
--- a/package.json
+++ b/package.json
@@ -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": {
diff --git a/polymer-imports.js b/polymer-imports.js
index 3271de3..2147933 100644
--- a/polymer-imports.js
+++ b/polymer-imports.js
@@ -23,7 +23,8 @@ const config = {
bowerFolderName: "bower_components",
ignoredFolders: ["test", "demo"],
ignoredComponents: [],
- animationAttributes: [
+ attributes: [
+ "effects",
"entry-animation",
"exit-animation"
],
@@ -172,7 +173,7 @@ function findOldImportsAndCreateImportsNode(d) {
findAndRemoveImports(el);
}
});
- likeBreaksToRemove.forEach(function(el){
+ likeBreaksToRemove.forEach(function (el) {
treeAdapter.detachNode(el);
});
}
@@ -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);
@@ -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] = '';
+ });
}
})
}