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

allow adding custom supportedTypes #48

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

Conversation

unkstar
Copy link

@unkstar unkstar commented Feb 28, 2014

I develop this feature because I have to put a web worker's script on CDN, and inspired by pattern option from grunt-usemin

new option work like this:

    //define worker type
    function Worker_cdn() {
    };

    Worker_cdn.prototype = {
        run : function() {
            var self = this;
            return this.buffer.replace(/new\s+Worker\(\s*['"]([^"']+)['"]/gm, function(match, url) {
                return match.replace(url, self._replace(url));
            });
        }
    };
    //and add it to supported type

    cdn: {
            options: {
                cdn:'http://example.com/static/',
                flatten:false,
                supportedTypes:{"js":Worker_cdn}
            },
            dist: {
                src: [
                    '<%= yeoman.dist %>/*.html',
                    '<%= yeoman.dist %>/scripts/*.js'
                ]
            }
       }

This patch let user inherit from Job interface directly, this give user great flexibility, or maybe too much?
Job._replace may need a better name too.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@unkstar
Copy link
Author

unkstar commented Feb 28, 2014

4dadf75 fix the same problem as #45 , I prefer #45 than my own solution, please pull #45 intead

By the way, I can't find a reasonable way to write a test on this feature in orignial tests framework, it need a fully functioning grunt to work.

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.

None yet

1 participant