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

Update sprite.less to avoid compilation error on mixin call #187

Merged
merged 2 commits into from
Aug 19, 2016

Conversation

kazmiekr
Copy link
Contributor

Adds a dot before calling the less mixin otherwise this will generate syntax errors.

I'm using the following configuration in grunt-svg-sprite:

target: {
        src: '../svgs/*',
        dest: '.',
        options: {
            shape: {
                id: {
                    generator: generatorFunc
                },
                dimension: {
                    maxWidth: 76,
                    maxHeight: 76
                },
                spacing: {
                    padding: 1
                }
            },
            mode: {
                css: {
                    bust: false,
                    mixin: 'svg-mysvgs-common',
                    sprite: '../img/Icons',
                    prefix: '.myPrefix-',
                    dimensions: true,
                    render: {
                        less: {
                            dest: '../src/less/somelessfile.less'
                        }
                    }
                }
            }
        }
    },

will generate something like:

.svg-mysvgs-common() {
    background: url("../img/whatever.svg") no-repeat;
}

.myPrefix-some-svg {
    svg-trait-small-common();
    background-position: 16.666666666666668% 0;
    width: 50px;
    height: 50px;
}

in the output svg-trait-small-common() will cause a less compiler error. It needs the '.' before it.

This looks similar to a previous issue #133

Thanks so much for the hard work in this library!

Adds a dot before calling the less mixin otherwise this will generate syntax errors
@jkphl
Copy link
Collaborator

jkphl commented Aug 19, 2016

@kazmiekr Thanks for reporting this. However, with your patch applied the tests are now failing (see Travis results). I find the following LESS file created:

.svg-common() {
        background: url("svg/css.vertical-b87f0584.svg") no-repeat;
}

.svg-weather-clear {
        ..svg-common();
        background-position: 0 0;
        width: 48px;
        height: 48px;
}

/* ... */

As you see there are now two dots in front of the mixin call, whereas this has only been one prior to your patch. Could you please double-check that you are not using a pre-1.2.18 version of svg-sprite?

@coveralls
Copy link

coveralls commented Aug 19, 2016

Coverage Status

Coverage remained the same at 79.664% when pulling 609a624 on kazmiekr:master into 370cf6a on jkphl:master.

@kazmiekr
Copy link
Contributor Author

Updated the PR with a new commit, build seems to be passing now, I copied the dot into the wrong spot from where I had it in my local revision. Let me know what you think. Thanks!

@jkphl jkphl merged commit 609a624 into svg-sprite:master Aug 19, 2016
jkphl added a commit that referenced this pull request Aug 19, 2016
@jkphl
Copy link
Collaborator

jkphl commented Aug 19, 2016

Works now, thanks! Merged. ;)

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.

3 participants