Skip to content
This repository has been 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

Open
pipejesus opened this issue Aug 12, 2016 · 0 comments

Comments

@pipejesus
Copy link

pipejesus commented Aug 12, 2016

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

};
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant