Skip to content

How to compile custom module scss file in Magento 2 using snowdog frontools

I am using snowdog frontools for compiling scss to css in my magento 2 application.
I want to create a custom module for a feature for which I want to write some css code in scss format.
I created one scss file in the module app/code/Vendor/Modulename/view/frontend/web/css/_module.scss

and added this code in themes.json file

{
  "sg": {
    "src": "app/design/frontend/Vendor/sg",
    "dest": "pub/static/frontend/Vendor/sg",
    "locale": ["en_US"],
    "parent": "base",
    "stylesDir": "web/css",
    "postcss": ["plugins.autoprefixer()"],
    "modules": {
      "Vendor_Modulename": "app/code/Vendor/Modulename"
    },
    "ignore": [
      "*.xml"
    ]
  }
}

So I was expecting this module.scss to get compiled so that I can call it in layout xml file of my custom module.

<head>
        <css src="css/module.css" />
    </head>

However, this is not being compiled.

I also tried few more ways like mentioned below:

I created scss file in the module app/code/Vendor/Modulename/view/frontend/web/css/styles.scss
app/code/Vendor/Modulename/view/frontend/web/css/_styles.scss
app/code/Vendor/Modulename/view/frontend/styles/styles.scss
app/code/Vendor/Modulename/view/frontend/styles/_styles.scss

But none of the above files compiled.

I also want to know where can I check if the file is compiled or not. I checked var/view_preprocessed/frontools folder but I do not find any scss there.