Question

C'est la première fois que j'utilise Grunt et je ne comprends pas pourquoi il ne génère aucun CSS à partir de mon fichier sass.

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']);
};

Quand je cours grunt dans le terminal, je reçois un message de réussite

Running "sass:dist" (sass) task

Done, without errors.

Mais quand je regarde dans mon fichier style.css, il n’y a rien.

Je ne sais pas si cela est nécessaire, mais ceci est mon fichier SASS

_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;
  }
}

Merci pour tout retour

Était-ce utile?

La solution

Changement _styles.sass à styles.sass, il l'ignore parce qu'il pense que c'est un mixin.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top