raklos
raklos

Reputation: 28545

Combining scss files into one with imports

If I want to split my scss into multiple files, does every file need an import statement.

Eg if I have

Will the (bottom) 3 files require imports in them (if they're using variables) I want to have a final file eg Site.scss that merges the 3 with imports

or should the variables imports go in Site.scss too?

Upvotes: 1

Views: 932

Answers (2)

Khang Lu
Khang Lu

Reputation: 1009

In your Site.scss file, import the _variables.scss at the top and all other files below it

@import 'variables';
@import 'Header';
@import 'Footer';
@import 'Content';    

That way all other files can use the variables. You don't need to include _variables.scss in every other files.

Upvotes: 2

Okomikeruko
Okomikeruko

Reputation: 1173

Every file needs an import statement, but they can all be in the root file.

Here's a great little tutorial that I've been following to make it work:

How to Structure a SASS Project

Upvotes: 1

Related Questions