Code Monkey home page Code Monkey logo

polymer-auto-import's People

Contributors

isuslov avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

polymer-auto-import's Issues

Preserve existing attributes and save old imports.

Right now the script removes all existing imports and creates new.
Instead of this it is better to save all unused imports under special comment
<!--UNUSED DIRECTLY-->

Also if import already exists it is important to preserve all its attributes.

Import icons

Right now <iron-icon icon="menu"></iron-icon> is not resolved to import

<link rel="import" href="/components/iron-icons/iron-icons.html">

Should be:

  • all elements with atrribute name icon should be checked:
    • if icon attribute value is not url and does not contain :, standard iron-icons should be imported
    • if icon attribute value is a url -> ignore
    • if icon attribute value has namespace separated with :, than specific icon set should be imported with the name of namespace.

Import behaviors

To import behaviors we can look at behaviors array and normalize last word from right.

For example Polymer.IronResizableBehavior should become IronResizableBehavior and then de-camelcased to iron-resizable-behavior.html for look up.

MyNamespace.Something.SomeBehavior to some-behavior.html.

Import animations

Currently animations are ignored.
What could be done:

  • look for entry-animation and exit-animation attributes.
  • look for animationConfig property

Make config path and/or root path as an arguments.

Optionally there should be ability to path rootPath (path to the root of the project) and config.json file path for configuration this way:
For second and third arguments should be this rule:
-If argument exists and is a directory, treat it as root path of the project.
-if argument exists and is .json file, treat it as config file.

Default config contains following properties:

{
    "rootDir": "",
    "bowerFolderName": "bower_components",
    "ignoredFolders": ["test", "demo"],
    "ignoredComponents": [],
    "attributes": [
        "effects",
        "entry-animation",
        "exit-animation"
    ],
    "resolve: {
        "iron-flex": "iron-flex-layout-classes",
        "iron-flex-reverse": "iron-flex-layout-classes",
        "iron-flex-alignment": "iron-flex-layout-classes",
        "iron-flex-factors": "iron-flex-layout-classes",
        "iron-positioning": "iron-flex-layout-classes"
    }
}

When property in custom config exists, default property should be overridden. No merge.

Polymer 3

hey! Are you still using this yourself? Would love it for Polymer 3, shouldn't be so different. The paths basically stayed the same, gotta use es6 imports now instead though. What do you think?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.