I am trying to setup an architecture for using SCSS
with my angular 4 project rather than plain CSS
. Uptil now i have followed the Angular Style guide to arrange CSS simply adjacent to components ts
files with each component having a separate directory, as in following the feature first approach.
Since now i am moving to using SCSS
, i simple replaced my CSS
files with SCSS
files. But i am not able to understand, where exactly should i put my _variables.scss
, _mixins.scss
, and common styles.scss
files, such that variables are always the first to load, so that variables dependencies can be resolved in the SCSS
files.
I am using webpack to compile my SCSS
files.
webpack.config.js
module: {
rules: [
{
test: /\.ts$/,
loaders: ['awesome-typescript-loader', 'angular2-template-loader']
},
{
test: /\.html$/,
loader: 'html-loader'
},
{
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
loader: 'file-loader?name=assets/[name].[ext]'
},
{
test: /\.scss$/,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" },
{ loader: "sass-loader" }
]
}
]}
Since i am not very good at designing and architecturing an app, any help would be highly appreciated.