Importing partials in Sass
Just as you can do in Harp.js
, you can use partials in Sass. If you've forgotten what a partial is, it's a little snippet of code that is saved into a different file and then imported into the main CSS theme or layout, in the case of Harp. This can be handy for making your CSS modular and easier to manage. For example, it would make a ton of sense to break every Bootstrap component into its own CSS file and then use the @import
directive to bring them all into a single master theme, which is then included in your project. Let's go over an example of how you could do this for a single component. In your project, go to the /css
directory and create a new sub-folder called /components
. The the full path should be:
/css/components
In the /components
directory, create a new Sass file and name it _buttons.scss
. Make sure you always insert an underscore at the start of the filename of a partial. The compiler will then ignore these files as the underscore means it...