Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Let you add flags for folder paths #279

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

LasseSviland
Copy link

I have changed my project a bit and made some changes to still be able to use the generator, maybe someone else will have use for it as well :)

Let you use optional flags to specify the path to the app folder, elements folder and bower_components for the element generator, it will not do any changes to the current behavior.
This way you can still use the generator without needing to have all the same setup as the default.

usage:
yo polymer:el my-element --app="path/to/my/app/folder"
Let you specify the path to the app folder, or use current directory by setting --app to "."

yo polymer:el my-element --elements="my_elements"
Let you specify a path to the elements folder relative to the app folder, or use the app folder by setting --elements to "."

yo polymer:el my-element --bower="my_bower_components"
Let you specify a path to the bower_components folder relative to the app folder.

var pathToBowerComponents;
var pathToApp;

// Let yoy spesify a path to the app folder

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo: yoy spesify should be you specify. Same mistake at lines 108 and 122.

pathToApp = this.flags.app;

// adding / to the end of the path
if (pathToApp.charAt(pathToApp.length - 1) !== '/' ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested this in Windows? I'm not sure if it'll work as written because they use \ file paths

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the previous code it do also have the / hardcoded.
pathToEl = path.join(this.destinationPath('app/elements'), this.flags.path);
I have only moved the hardcoded values out to variables that can be changed with the flags.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants