Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-defined resources for the --watch option #80

Closed
wants to merge 5 commits into from
Closed

User-defined resources for the --watch option #80

wants to merge 5 commits into from

Conversation

bretkikehara
Copy link

This will allow compilation of files other than .js, .css, and .json files using the shifter --watch command. Basically, I want to watch for any changes in LESS files so that the a module's CSS is updated automatically.

This command will commonly be used in conjunction with the "exec" option in a module's build.json.

An example build.json:

{
    "name": "module",
    "exec": [
        "less-compile"
    ],
    "builds": {
        "module": {
            "jsfiles": ["module.js"],
            "skinnable": true
        }
    }
}

How to use:

This can be added to the .shifter.json file:

{
    "watched-extensions" : {
        ".less": true,
        ".js": true,
        ".json": true
    }
}
or alternatively,

shifter --watch js --watch less --watch json

Known issues:

Currently, CSS and LESS files cannot be watched together else shifter will indicate that the CSS file has been changed too quickly. This is why the previous example does not watch CSS, only LESS.

@derek
Copy link
Contributor

derek commented May 10, 2013

Nice idea.

I'd prefer to see --watch accept a String as opposed to a Boolean, it seems redundant to specify --watch and --watched-type together as the latter implies the first should be true.

Also, IMO it also seems unnatural to specify an escaped JSON string in the CLI arguments, so I'd rather see additional --watch arguments for each extension, and nopt will turn it into an array when it parses the arguments list.

For example...

Defaults to watching .css, .js, and .json

--watch 

Ignores defaults, only watches .less

--watch less

Ignores defaults, watches .less and .js

--watch less --watch js

This way, you don't have to specify which extensions you don't want to watch, just the ones you do. I guess it would be possible to add in support for --no-watch, but that seems unnecessary at the moment.

Under the hood in the .shifter.json config, getting picky I'd prefer watched-extensions, but otherwise the implementation seems sound.

@evocateur
Copy link
Contributor

I concur with @derek's comments. nopt is full of win.

Bret Ikehara and others added 5 commits July 16, 2013 01:34
…hifter.json file.

Added the watched-types configuration.
Allows for --watch multiple time instead of an object as an argument.
Changed the 'watched-extensions' global config to array instead of object.
Updated version of cssproc dependecy to 0.0.3
@caridy
Copy link
Member

caridy commented Jun 9, 2014

Yogi does the watching, closing this.

@caridy caridy closed this Jun 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants