Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Using Compass and Autoprefixer in Grunt

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #171407
    Scott Lyttle
    Participant

    Curious about whether there’s a way to use both Autoprefixer and Compass in Grunt without having to specify a different output path for each task.

    I currently have my SCSS files in a folder named ‘source’. The compass task compiles these into a folder named ‘build’. I can’t seem to then run Autoprefixer without having to specify another different output path, like ‘build-prefixed’.

    Is it not possible to just Autoprefixer on a compass compiled CSS file without specifying a different output path?

    Here’s the section of my gruntfile it relates to if it’s of any help:

    compass: {
        options: {
            sassDir: 'style/source',
            cssDir: 'style/build',
            outputStyle: 'expanded',
        }
    },
    watch: {
        css: {
            files: ['style/source/**/*.scss'],
            tasks: ['compass'],
            options: {
                spawn: false,
            }
        }
    },
    

    Refs:
    https://github.com/nDmitry/grunt-autoprefixer
    https://github.com/gruntjs/grunt-contrib-compass

    #171473
    Scott Lyttle
    Participant

    Answered my own question. Appears if you do not specify an output location for Autoprefixer, it will just use the input location and overwrite the files. Here’s the updated section of the gruntfile if it’s of help t anyone:

    autoprefixer: {
        css: {
            src: 'style/build/**.css',
        }
    },
    watch: {
        options: {
            livereload: true,
        },
        css: {
            files: ['style/source/**/*.scss'],
            tasks: ['compass', 'autoprefixer:css'],
            options: {
                spawn: false,
            }
        }
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Other’ is closed to new topics and replies.