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

Restructure configuration #7

Closed
GaryJones opened this issue Oct 30, 2014 · 2 comments
Closed

Restructure configuration #7

GaryJones opened this issue Oct 30, 2014 · 2 comments

Comments

@GaryJones
Copy link

The usual approach to configurations is to use the options object, as this can be set for all targets, and then optionally overridden in specific targets. i.e. given:

// https://github.com/RealFaviconGenerator/grunt-real-favicon
real_favicon: {
    favicons: {
        src: '<%= paths.authorAssets %>images/dt-logo-circle.png',
        dest: '<%= paths.authorAssets %>images/favicons-generated/',
        html: [],
        design: {
            ios: {
                picture_aspect: 'no_change'
            },
            windows: {
                picture_aspect: 'no_change',
                background_color: '#2b5797' // One of the recommended Windows UI colors
            }
        },
        settings: {
            compression: 2
        }
    }
};

I'd expect it to be more like:

real_favicon: {
    options: {
        html: [],
        ios: {
            picture_aspect: 'no_change'
        },
        windows: {
            picture_aspect: 'no_change',
            background_color: '#2b5797' // One of the recommended Windows UI colors
        },
        compression: 2
    },
    favicons: {
        src: '<%= paths.authorAssets %>images/dt-logo-circle.png',
        dest: '<%= paths.authorAssets %>images/favicons-generated/',
    }
};

...which would then allow easier overriding, such as:

real_favicon: {
    options: {
        html: [],
        ios: {
            picture_aspect: 'no_change'
        },
        windows: {
            picture_aspect: 'no_change',
            background_color: '#2b5797' // One of the recommended Windows UI colors
        },
        compression: 2
    },
    theme1: {
        src: '<%= paths.authorAssets %>images/dt-logo-circle.png',
        dest: '<%= paths.authorAssets %>images/favicons-theme1/',
    },
    theme2: {
        options: {
            windows: {
                background_color: '#000000'
            }
        },
        src: '<%= paths.authorAssets %>images/dt-logo-circle.png',
        dest: '<%= paths.authorAssets %>images/favicons-theme2/',
    }
};

I realise this is going to be backwards-incompatible, but it would bring it more inline with how the majority of Grunt tasks are written.

@phbernard
Copy link
Contributor

My Grunt newbieness is revealed :)

Makes sense. The plugin is in its infancy. I don't consider incompatibility is a problem at this stage.

@phbernard
Copy link
Contributor

Done, will be part of v0.1.0

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

No branches or pull requests

2 participants