Skip to content
This repository was archived by the owner on Sep 25, 2020. It is now read-only.
This repository was archived by the owner on Sep 25, 2020. It is now read-only.

grunt-autoprefixer + grunt-contrib-watch (livereload) + grunt-sass = livereload "catches" every other time #126

Description

@pipejesus

Hi, after adding grunt-autoprefixer to my watch task 2 things broke:

  1. Livereload reloads my page every other time (one save: no reload, next save: reloads - always this way)
  2. The generated sourcemaps reference wrong lines

My configuration:

module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        autoprefixer: {
          options: {
            browsers: ['last 20 versions'],
            map: true
          },
          dist: {
            expand: true,
            flatten: true,
            src: 'css/*.css',
            dest: 'css/'
          }
        },
        watch: {
            sass: {
                files: ['sass/**/*.{scss,sass}'],
                tasks: ['sass:dist', 'autoprefixer:dist'],
            },
            livereload: {
                files: ['**/*.html', '**/*.php', 'js/**/*.{js,json}', 'css/**/*.css','img/**/*.{png,jpg,jpeg,gif,webp,svg}'],
                options: {
                    livereload: true
                }
            }
        },
        sass: {
            options: {
                sourceMap: true,
                outputStyle: 'expanded',
                precision: 8
            },
            dist: {
                files : [
                    {
                        src : ['**/*.scss'], //,'!**/_*.scss' 
                        cwd : 'sass',
                        dest : 'css',
                        ext : '.css',
                        expand : true
                    }
                ],
            }
        }
    });

    grunt.registerTask('default', ['sass:dist', 'watch']);
    grunt.loadNpmTasks('grunt-sass');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-autoprefixer');

};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions