In this recipe, we'll make use of the sass (0.12.1)
plugin to generate source maps when compiling our Sass style sheets to CSS.
In this example, we'll work with the basic project structure that we created in the Compiling Sass to CSS recipe in this chapter. Be sure to refer to it if you are not yet familiar with its contents.
The following steps will take us through altering our configuration so that a source map is generated when our Sass style sheet is compiled to CSS:
First, we'll indicate that we'd like to generate a source map by setting the
sourceMap
option totrue
in oursass
task's configuration:sass: { styles: { options: { sourceMap: true }, src: 'styles.scss', dest: 'styles.css' } }
Then, we can run the task by using the
grunt sass
command, which should produce output similar to the following:Running "sass:styles" (sass) task File styles.css created. File styles.css.map created.
If we now take a...