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

When use indentedSyntax option, have to use .scss to import scss file #135

Closed
indigofeather opened this issue Jul 31, 2015 · 8 comments
Closed

Comments

@indigofeather
Copy link

Hi, I got a problem, when used indentedSyntax option, it occurred error:

ERROR in ./~/css-loader?sourceMap!./~/sass-loader?indentedSyntax&sourceMap&sourceMapContents!./src/css/application.sass
    Module build failed: 
    @import 'foundation/reset'
           ^
          File to import not found or unreadable: foundation/reset.sass
          in /home/**/src/css/application.sass (line 12, column 9)

Before using sass-loader, for example, we have foundation/_reset.scss file, in normal usage (Ex: ruby-sass, node-sass):

// -------------------------------------
//   Foundation
// -------------------------------------

@import 'foundation/reset'
@import 'foundation/helpers'
@import 'foundation/config'
@import 'foundation/base'

use sass-loader, we have to be:

// -------------------------------------
//   Foundation
// -------------------------------------

@import 'foundation/reset.scss'
@import 'foundation/helpers'
@import 'foundation/config'
@import 'foundation/base'

But it's not necessarily to set extension for these files.

in index.js @ line 140:

// indentedSyntax is a boolean flag
opt.indentedSyntax = Boolean(opt.indentedSyntax);
fileExt = '.' + (opt.indentedSyntax? 'sass' : 'scss');

in index.js @ line 92:

if (!url.match(extensionMatcher)) {
    extension = contextMatch && contextMatch[0] || fileExt;
    url = url + extension;
}

Without above, it works fine!
Any insight would be appreciated!

@fraina
Copy link

fraina commented Aug 3, 2015

+1, it would be awesome if I don't have to check extension before import module's stylesheets.

e.g.

@import './node_modules/susy/sass/susy'
@import './node_modules/breakpoint-sass/stylesheets/breakpoint'
@import 'foundation/susy_config'

instead of

@import './node_modules/susy/sass/susy.scss'
@import './node_modules/breakpoint-sass/stylesheets/breakpoint.scss'
@import 'foundation/susy_config'

@jorrit
Copy link
Contributor

jorrit commented Aug 3, 2015

I am assuming you have scss and sass in your resolve.extensions of the webpack.config.js file?

@indigofeather
Copy link
Author

Hello, @jorrit
I just use ['', '.js'] in resolve.extensions, and loaders has:

  {
    test: /\.scss$|\.sass$/,
    loader: ExtractTextPlugin.extract('css-loader?sourceMap!autoprefixer-loader?{browsers:["last 2 version"]}!sass-loader?indentedSyntax&sourceMap&sourceMapContents')
  }

@jhnns
Copy link
Member

jhnns commented Aug 5, 2015

Could you guys check out the current master branch and check if it works for you? I've heavily refactored the import mechanism and need more tests.

@indigofeather
Copy link
Author

Hello @jhnns
I've tested the current master branch, it works!

@jhnns
Copy link
Member

jhnns commented Aug 5, 2015

Thx. That's what I wanted to hear 👍 😀.

@indigofeather
Copy link
Author

Waiting for the next version 👍

@jhnns
Copy link
Member

jhnns commented Aug 6, 2015

Shipped with 2.0.0

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

4 participants