One of several exciting brand brand brand new features in Sass 3.3 that each developer should simply just just take benefit of is source maps.
In training, for Sass users, which means whenever you examine a component with designer tools, instead of seeing the CSS designs connected with that element, you can view the code we actually worry about: the pre-compiled Sass.
Generating source maps for Sass
To obtain use of this particular feature within the web web web browser, you will need to create a source map apply for each supply file.
For Sass, this will be as simple as incorporating a banner to Sass’s demand line tool:
In the event that you look in your production folder after operating that demand, you are going to observe that a comment was put into the conclusion regarding the CSS that is generated file
Enabling supply maps when you look at the web browser
The 2nd thing we should do to make the most of supply maps is always to make sure our web web browser understands try to find them. Chrome, Firefox and Safari all have support for supply maps.
If you should be making use of Chrome, supply maps are actually an element of the core feature set, and that means you don’t need to monkey around in chrome://flags any longer. Merely start up the DevTools settings and toggle the Enable CSS supply Maps choice:
For Firefox users, source maps have been in variation 29. You are able to allow them into the Toolbox Alternatives menu (the apparatus symbol) or by right-clicking any place in the Style Inspector’s guideline view and choosing the Show sources that are original. (more information can be acquired during the Mozilla weblog.)
Safari is a little prior to the bend with regards to supply map help. No configuration necessary if a map file is detected, references are automatically changed to the source-mapped files.
Another device within our gear
When supply maps are enabled in your web browser of preference, the origin guide for every single design can change through the generated CSS to your supply Sass, down to the line quantity. Amazing!
Just like Firebug and its own successors drastically enhanced our ability to debug within the web browser, supply maps boost the level of our capabilities that are diagnostic. By permitting us to directly access our code that russian mail order wives is pre-compiled will get and fix dilemmas faster than in the past. Given that i am utilizing supply maps for a couple months, i can not imagine working without them.
Connect to Tim on twitter at @timhettler.
The Sass Method covers the latest news and topics on handcrafting CSS with Sass and Compass. We make use of a publishing that is open and depend on contributions through the Sass community via our GitHub project.