How can I use Sass in Shopify-cli created app?

Solved

How can I use Sass in Shopify-cli created app?

PhilippW
Excursionist
17 0 2

How can I load the appropriate loader to use scss in my app?

 

I tried adding the scss loader to the next.config.json :

Screen Shot 2019-11-12 at 6.18.39 PM.png

 

but then the css loader does not seem to work anymore:

console.jpg

 

Does anyone know how to add it properly?

Accepted Solution (1)

katiedavis
Shopify Staff (Retired)
39 7 13

This is an accepted solution.

Hi @PhilippW,

 

You've wrapped the config correctly with `next-sass`, but you still need the CSS loader:

 

module.exports = withCSS(withSass({
  webpack: config => {
    const env = { API_KEY: apiKey };
    config.plugins.push(new webpack.DefinePlugin(env));
    return config;
  }
}));

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 2 (2)

katiedavis
Shopify Staff (Retired)
39 7 13

This is an accepted solution.

Hi @PhilippW,

 

You've wrapped the config correctly with `next-sass`, but you still need the CSS loader:

 

module.exports = withCSS(withSass({
  webpack: config => {
    const env = { API_KEY: apiKey };
    config.plugins.push(new webpack.DefinePlugin(env));
    return config;
  }
}));

To learn more visit the Shopify Help Center or the Community Blog.

PhilippW
Excursionist
17 0 2

Thank you @katiedavis! It's working perfectly for me now.