Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
how to add global scss styles to preact app

I created preact template from default preact-cli template

added:

"sass": "^1.45.1",
"sass-loader": "^10.2.0",

import global scss file into index.js and global styles work fine

import "./style/global.scss";
import App from "./components/app";
export default App;

added into global.scss file mixin and scss vars:

@mixin br {
  border-radius: 12px;
}

and when i try to use it in some component like:

 .merchant {
    margin-bottom: 4px;
    @include br;
  }

I get error:

Module build failed (from ../node_modules/preact-cli/lib/lib/webpack/proxy-loader.js):

    @include br;
   ^
      Undefined mixin.
  ╷
6 │     @include br;
  │     ^^^^^^^^^^^
  ╵
  stdin 6:5  root stylesheet
      in ./src/components/header/style.scss (line 6, column 5)
 @ ./components/header/style.scss 2:12-238 9:17-24 13:7-14 45:20-27 47:4-60:5 49:6-59:7 50:38-45 56:26-33 58:21-28 68:15-22
 @ ./components/header/index.js
 @ ./components/app.js
 @ ./index.js
 @ ../node_modules/preact-cli/lib/lib/entry.js

looks like i need to something like loader for this and where I need to add it?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You'll need to import the SCSS file if you want to use anything from it.

@import 'path/to/global.scss';

.merchant {
    margin-bottom: 4px;
    @include br;
}

To clarify, this is normal practice when working with SCSS; variables and mixins are not added as globals to your loader (and I've never seen a setup where they were, so I'm curious if you've ran into a system like this). The SCSS processor will compile each file individually, so without an import, it won't be able to resolve your mixin.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!