Answer the question
In order to leave comments, you need to log in
How to work with small css files?
I have been working as a layout designer for about a year, during this time I always wrote styles in one large "main.css" file, where I connected css-reset, font faces, main styles, plugin styles, in general, absolutely all styles.
I recently realized that it's a good practice in the frontend to break up js and css files into small component modules in development, and glue everything into one big one in production.
I have one major project on the way, and I set out to organize the development and support process competently.
I want to write styles in small sass files.
The question is - how to work with small css files? Just write paths to files in head during development, and glue them into one in production? Or use grunt and similar tools for this, and what is the best way to do this?
I've never worked with grunt, just started tinkering.
Is there any best way in this matter?
Answer the question
In order to leave comments, you need to log in
Maybe I'll answer a little offtopic, but still.
What's wrong with a single style file? Unified - this means that it contains all the styles related to the layout of the site, with the exception of the basic styles of plugins, fonts. Reset - as for me, it’s generally a universal evil, only problems I have always had from it ...
Take a look at sprockets , by all indications this is what you need. This library is used in RubyOnRails just to build css, js and can compile scss/sass, CoffeeScript
. manifest files (own for css and js) in which you specify what should be packed into the resulting files (css and js, respectively).
For example, a manifest for css, it uses the commands
require_self - include the manifest itself in the assembly (what is after the manifest-comment)
require path / filename - include a specific file, usually these are third-party components
require_tree . - include all files from the directory, in this example, everything that is in the directory with the manifest
/*
*= require_self
*= require bootstrap-datepicker
*= require select2
*= require select2-bootstrap
*= require dropzone-basic
*= require_tree .
*/
I want to write styles in small sass files.
The question is the following - how to work with small css files
I make main.less and in it:
@import "mixins";
@import "variables";
@import "reset";
@import "typography";
@import "grid";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question