DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • How to Effortlessly Host Your Angular Website on GitHub Pages
  • Angular vs. Flutter for Web App Development: Know Which One Is Best?
  • Difference Between Bootstrap and AngularJS in 2022
  • The Best Javascript Frameworks for 2022

Trending

  • Supervised Fine-Tuning (SFT) on VLMs: From Pre-trained Checkpoints To Tuned Models
  • Traditional Testing and RAGAS: A Hybrid Strategy for Evaluating AI Chatbots
  • Go 1.24+ Native FIPS Support for Easier Compliance
  • Creating a Web Project: Caching for Performance Optimization
  1. DZone
  2. Coding
  3. Frameworks
  4. A Brief Guide to Using Sass/SCSS in an Angular App

A Brief Guide to Using Sass/SCSS in an Angular App

I was wondering how to structure the pre-processor scripting language Sass/SCSS files in an Angular project. And, turns out there are several solutions.

By 
Alexey Shepelev user avatar
Alexey Shepelev
DZone Core CORE ·
Oct. 04, 21 · Opinion
Likes (13)
Comment
Save
Tweet
Share
11.0K Views

Join the DZone community and get the full member experience.

Join For Free

Method 1

To Keep All Style Files in the /Styles Folder

In this case, we create all files in the /styles folder by following a pattern structure:

Shell
 
styles 
	├── base 
	├── components
	└── xxxxx


One of the popular methods to structure files in this way is the 7-1 pattern suggested in the sass documentation. More details can be found here.

The Pros of This Approach:

  1. All style files are in one place.

  2. Style building becomes faster.

Cons:

  1. The developer must know where the required file should be located.

  2. The file structure may get messy in a large project.

Method 2

To Keep Each Style File in the Component and Add Global Styles to the /Styles Folder

In this case, we leave component style files in components and move global styles to /styles. Files with variables and mixins are also added to the /styles folder and then imported into the component style files. The /styles folder looks the same as in the first method but has no component styles.

The Pros of This Approach:

  1. Components have their style files.

  2. It is easier to achieve a clean structure for style files.

Cons:

  1. Building style files can get slower in a large project.

Method 3

To Move All Component Styles to a Single File and Keep Global Styles in the /Styles Folder

It looks like the first method except that component styles are contained in a single file that is stored in the components folder.

The Pros of This Approach:

  1. Components have their single style file which can be quickly accessed.

  2. Style building is faster.

Cons:

  1. You always need to import the common component style file into the style file of a new component.

Of the three methods found, the second one seems to be the most effective for an Angular application. The first one is more suitable for layout projects without frameworks. The third method looks rather strange, although it may be convenient.

Thank you for your time, and have a nice day!

AngularJS app

Opinions expressed by DZone contributors are their own.

Related

  • How to Effortlessly Host Your Angular Website on GitHub Pages
  • Angular vs. Flutter for Web App Development: Know Which One Is Best?
  • Difference Between Bootstrap and AngularJS in 2022
  • The Best Javascript Frameworks for 2022

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!