Grunt sass not outputting any css
-
20-12-2019 - |
Question
This is my first time using Grunt and I'm confused why it's not outputting any css from my sass file.
Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
style: 'compressed'
},
files: {
'assets/css/style.css': 'assets/sass/_styles.scss'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.registerTask('default', ['sass']);
};
When I run grunt
in the terminal I receive a success message
Running "sass:dist" (sass) task
Done, without errors.
But when I look in my style.css file, nothing is there.
I'm not sure if this is necessary, but this is my sass file
_styles.scss
$font-stack: Helvetica, sans-serif;
$primary-color: #333;
body {
font: 100% $font-stack;
color: $primary-color;
}
nav {
ul {
margin: 0;
padding: 0;
list-style: none;
}
li { display: inline-block; }
a {
display: block;
padding: 6px 12px;
text-decoration: none;
}
}
Thanks for any feedback
Solution
Change _styles.sass
to styles.sass
, it's ignoring it because it thinks this is a mixin.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow