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

wants to merge 5 commits into
base: master


None yet
4 participants

bretkikehara commented May 3, 2013

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": [
    "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.


This comment has been minimized.


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


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.


This comment has been minimized.


evocateur commented May 11, 2013

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

Bret Ikehara and others added some commits May 3, 2013

Added the code to allow a user to define a watched resource in the .s…
…hifter.json file.

Added the watched-types configuration.
Changed watched-types to watched-extensions.
Allows for --watch multiple time instead of an object as an argument.
Expanded upon the tests for watched-extensions.
Changed the 'watched-extensions' global config to array instead of object.
Updated version of cssproc dependecy to 0.0.3

This comment has been minimized.


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