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

add 'alias' option #15

Open
yoannisj opened this issue Oct 16, 2015 · 2 comments
Open

add 'alias' option #15

yoannisj opened this issue Oct 16, 2015 · 2 comments

Comments

@yoannisj
Copy link

For projects where your sass code is separated in different directories (bundles), it would be great to have an option to provide aliases. This option would map an arbitrary 'module/bundle' name to a sub-directories inside a project, in a similar way as what webpack does with its resolve.alias option.

Here is how it could work:

node file

var sass = require('node-sass'),
    importOnce = require('node-sass-import-once');

sass.render({
  file: scss_filename,
  importer: importOnce,
  importOnce: {
    bower: true,
    alias: {
      'foo': path.join(__dirname, './src/bundles/foo/stylesheets/scss'),
      'bar':  path.join(__dirname, './src/bundles/bar/stylesheets/scss')
    }
  }
});

sass file (can be in any directory, e.g. in ./src/bundles/baz/stylesheets/some/module/file)

@import "foo/module/filename"; // ./src/bundles/foo/module/(_)filename.s(c|a)ss
@import "bar/filename"; // ./src/bundles/bar/(_)filename.s(c|a)ss

Aliases would override bower/node modules in case of a name conflict.

@dougludlow
Copy link

I'd really like to see this as well.

@aharmo3
Copy link

aharmo3 commented Jun 22, 2017

+1

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

4 participants