Skip to content

Conversation

DisasterMan78
Copy link

I needed to access the options object in a custom spritey-less template.
This sprity issue said it's not possible, and after a little hacking it didn't seem worth the effort of doing it in sprity, and it proved much easier in sprity-less.

It still doesn't handle the handlebars tabs as well as when processing the default template, but it's much better than overwriting the default template file, as that is outside of the development repo.

Uses process.cwd() to compile the template filename, so paths should be relative to your project root.

gulp.task('sprites', function() {
    log('Compiling png sprites');
    return sprity.src({
        [other options]
        template: './src/sprity_template/less.hbs',
        processor: 'less'
    })
    .pipe(
        gulpif('*.png', gulp.dest(config.spritesBuild), gulp.dest(config.client + 'styles/sprites'))
    );
});

@DisasterMan78
Copy link
Author

Hmm. That's disappointing - not sure why a change to getTemplate should cause a timeout fail on 'should return the correct less'. I can only assume the test doesn't support the change I've made.
I'll look into the test shortly, though I realise I should have written/modified a failing test first. In my rush I didn't consider this would be a breaking change.

Bad boy...

[update]
The tests actually fail on the master branch, so it appears I have not made a breaking change.
The modified plugin runs as desired within my project.

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.

1 participant