Errors in Sass compilation and Compass Compilation
Some time ago, when I used Compass, I encountered a difficult problem. Now I have recorded my blog to help you.I. Problems:
When using Koala or gulp for compilation, the following error is prompted:
Ii. Solution
From the question point of view, the prompt is not found. A folder under the sass-cache folder (the parent directory name contains special char
This is a memorandum of understanding.1. Number
type-of(0) // numbertype-of(1px) // number2. String
type-of(a) // stringtype-of("a") // string3. bool
type-of(true) // booltype-of(04. Color
type-of(rgba(1,2,3,.3)) // colortype-of(rgb(1,2,3)) // colortype-of(#fff) // colortype-of(red) // color5. List (SASS. List = Js.
Introduction: WEB front-end HTML pages and CSS files can sometimes be cumbersome to write, but with tools that help us easily build pages. Sass is a CSS development tool, with the corresponding syntax, you can have logic and concise writing CSS code. This article describes the main is based on Dreamever CS5 plus Emmet plug-ins to quickly write concise HTML pages.
1. Ruby Installation and ConfigurationRuby can be found in Baidu search Baidu Softwar
Download and install sass and compass in ruby, and reference css styles.
It is very convenient to use scss to write css. The first is ruby download and installation, is the http://rubyinstaller.org/downloads. After the download, open the installation file and click Next to install it. Note that
Check the following to prevent future commands from being found.After the installation is complete, click it to open it.Run the gem install
Variable
If you are a developer, variables should be your best friend. If you want to reuse a message (color in this example), set it to a variable. In this way, you can ensure your consistency and reduce the complexity of scrolling code to search for color values, copy and paste. You can even add or subtract the HEX value you need to render to these colors. Let's take a look at the example:
@ Blue: # 00c; @ light_blue: @ blue + #333; @ dark_blue: @ blue-#333;
If we apply these styles to three D
My environment: Win7-64bit WEBSTORM9Webstorm Installing the Sass PluginTo have Webstorm automatically compile the sass file:Open the Settings window->file watchers-> to the right of the green plus->scssClick OK to finish compiling the Scss file.Further configuration 1:Always generate CSS and Css.map filesIn ' Arguments ':--no-cache--update $FileName $: Add--sourcemap--watch $FileNameWithoutExtension $.cssi.
Koala download sass Compile as CSS fileRequirejs Why use1, effective to prevent naming conflicts2. Declare the dependencies between different JS files3. Let our code be organized in a modular wayRequirejs Common methods1. Requirejs.config Definition AliasesMain.js Portal File (files that are called immediately after the Require.js file is loaded in the. html is the entrance file in Data-main way)reuirejs.config ({ paths:{ jquery:'
Two SCSs formats
Sass braces
SCSs CSS writing
Arguments: -- no-Cache-style compressed -- Update $ filename $: CSS/$filenamewithoutextension}.css
The marked part is the output CSS type and the additional output path, that is, whether the output CSS is compressed or not, and then the project directory creates a CSS folder to put it inside.
-- Style
Nested: Nested indent CSS code
Expanded: CSS code without indent Extension
Compact: Concise CS
Mixed macros are primarily used to pass parameters, but when Sass compiles the same mixed macro, the same styles are not merged. Generates redundant code.Inheritance is primarily used where arguments are not passed, and the base class already exists, and the same style is merged after compilation, not enough: the declared base class generates code regardless of whether the base class is called.Placeholders are similar to inheritance, but placeholders
another value when the condition is not true: if ($condition, $if-true, $if-false)Example:{ padding: if (true,2px,3px);}Output:{ padding: 2px;}VI. type of MapThe map in sass is often referred to as a data map, and some people call it an array, as he always appears in pairs of key:value, more like a JSON dataExample:$color: ( default: #fff, Primary: #22ae39, negative: #d9534f );function function of map. Map with seven functions in sass
1. Set up a configuration file after Sass and compass are installed2. Add a Sprite folder to hold the pictures that will be merged, such as the color folder[email protected] The command Reference. when Compass sees the @import parameter for the instruction *.png , it assumes that all the pictures under this directory are .png made into a sprite.You can also use certain rules to make it according to the picture and layout you need to generate the corre
A better name for the variable
Variables are one of the simplest features in sass, but sometimes they can be used improperly. Creating a site-wide, semantically variable is an essential task. If the name is not good, he will become difficult to understand and re-use.Here are some tips for naming variables that provide references:
Don't be vague when naming variables
Stick to a naming convention (Modular, BEM, etc.)
It makes sense
SASS writing skills
Better Name Variables
Variables are one of the simplest features of Sass, but sometimes they are not used properly. Semantic variables within the scope of site creation are indispensable. If the name is not good, it will become hard to understand and reuse.
Here are some tips for naming variables for reference:
Do not be vague when naming Variables
Stick to a naming rule (Modular,
Now the most common three CSS preprocessor frameworks are Sass, less CSS, and Stylus.For less, you can use the less file directly on the page, but you can refer to Less.js for parsing, and the less output as a CSS file. It is recommended to use the latter.The most commonly used less compiled output CSS tool: NPM associated with node. js, installing the less module and then using less test.less>test.css for output.Reference:Http://www.cnblogs.com/shaom
What is CsscombThe official website has only one sentence description:
Makes your code beautiful (make your codes more beautiful)
The popular point says:
Csscomb is used to typeset CSS code ... Can be said to be a format plug-in, relying on Nodejs
get csscomb– This isn't the topic of today.Official website: Csscomb
Supports many editors, such as sublime/atom/brackets, etc.
Third party csscomb-This is the topic of today.Yesterday wrote a CSS3 article ...
is my big gfw mighty, can change the source to x Treasure of the server to solve:$ gem sources-l$ gem sources--remove https://rubygems.org/$ gem sources-a http://ruby.taobao.org/$ gem sources-l//Then I just updated the ruby version $ sudo gem update--systemAfter the above toss, smooth installation sassCommon syntax variablesDefine $magin:30px; Px$blue: #1875e7; Color$side:left; Str usage:boder-#{$side}-radiusAll variables of the numeric type can be calculated accordingly.NestingNav { ul {...
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.