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

stringify object to pass as functions option #155

Closed
dtothefp opened this issue Aug 30, 2015 · 4 comments
Closed

stringify object to pass as functions option #155

dtothefp opened this issue Aug 30, 2015 · 4 comments

Comments

@dtothefp
Copy link

maybe this is an issue I should put on loader-utils but for the life of me I can't figure out how to stringify an object to pass as the functions option to node-sass. Seems like it would be easier for things like this if you would do something like check this.options.sass:

let functions = {
  'image-url($filename)': function(filename) {
    var imageUrl = process.env.NODE_ENV === 'development' ?
      '' :
      '';//enter CDN path here
    var fileName = filename.getValue();

    var imagePath = 'url("' + imageUrl + '/' + fileName + '")';
    /*eslint-disable */
    return new sass.types.String(imagePath);
    /*eslint-enable */
  }
}

`sass-loader?functions=${somehowStringify(functions))}`
@jorrit
Copy link
Contributor

jorrit commented Aug 31, 2015

PR #152 would help in your case I think.

@jhnns
Copy link
Member

jhnns commented Oct 5, 2015

Yep, #152 solves it. I just merged the PR, but we need tests 😀.

@jhnns
Copy link
Member

jhnns commented Oct 25, 2015

#152 shipped with 3.1.0. New preferred way for passing options is now via a property on your webpack config. See https://github.com/jtangelder/sass-loader#sass-options

@jhnns jhnns closed this as completed Oct 25, 2015
@dtothefp
Copy link
Author

@jhnns awesome...much appreciated

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

No branches or pull requests

3 participants