Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7690615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:26:17+00:00 2026-05-31T20:26:17+00:00

Hello I would like to use the sass module in a play application. We

  • 0

Hello I would like to use the sass module in a play application. We are already using press to minify css and include css files on individual views using #{press.stylesheet ‘path/to/mystylesheet.css’} etc. My question is can I use SASS to include individual views on a per page basis like we are doing with press.stylesheet?

Also if we can do this, I’m assuming we don’t need press anymore for css files since SASS can do it’s own minification.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:26:19+00:00Added an answer on May 31, 2026 at 8:26 pm

    Sass is a CSS meta-language so it’s output is css files. It’s not built to dynamically insert css into your views.

    You can use sass partials to keep your code separated into modular files, but then combine them into a single css file. By nesting the import statements under classes you can prefix each selector string in the partial with a unique class per page.

    This will result a single larger css file, however it will only be downloaded once and will be cached by the browser for all subsequent page requests.

    Here’s how to do do it…

    Sass Stylesheet with Nested Partials

    Step 1. Create a default Sass file that contains all the shared default styles. We’ll call this screen.sass.

    Step 2. Create partials for each of your pages:

    _about.sass
    _contact.sass
    _home.sass
    

    Step 3. Dynamically add a unique class to the body tag of your pages to identify them:

    about-page
    contact-page
    home-page
    

    Your file-structure should look like this:

    partials/
      _about.sass
      _contact.sass
      _home.sass
    screen.sass
    

    Step 4. In the screen.sass file do the following:

    // Shared default styles
    div
      color: #fff
    .home-page
      @import partials/home
    .about-page
      @import partials/about
    .contact-page
      @import partials/contact
    

    Assuming each partial contains rules to change the default color of the div element, this will result in the following:

    // Shared default styles
    div {
      color: #fff
    }
    .home-page div {
      color: #00f
    }
    .about-page div {
      color: #0ff
    }
    .contact-page div {
      color: #f0f
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I would like to use in my css simple inheritance from the browsers
I have the basic hello world application setup using wai, and would like to
Hello I would like to use preg_match in PHP to parse the Desired text
I'd like to create a basic Hello World style application for the IPhone using
FILE: hello world I would like to use a scripting language ( BASH )
Hello i a probleme i use getListView(); for my list1 and i would like
I am beginning a new Java web application using Netbeans, and I would like
I would like to use PDFKit in my Rails 3 application on Windows .
Hello I would like to use jQuery to wrap sets of elements in a
Hello I would like to develop using delphi 7 programming language but I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.