nDmitry / grunt-autoprefixer

Parse CSS and add vendor-prefixed CSS properties using the Can I Use database. Based on Autoprefixer.
MIT License
795 stars 60 forks source link

Autoprefixer runs successfully, but not outputting files #24

Closed brycepj closed 10 years ago

brycepj commented 10 years ago

Hi, I'm setting up Grunt and Autoprefixer in a new work environment, and for some reason I can't get it to work like it does for me on my own machine.

Here's my gruntfile:

module.exports = function(grunt) {

var version = grunt.option('pomVersion') || 'VERSION';

grunt.initConfig({

    project: {
        name: 'web-standard',
        version: version
    },

    less: {
        dev: {
            files: [
                {   
                    expand: true,
                    flatten:true,
                    src: 'src/main/less/*.less',
                    dest: 'target/css',
                    ext: '.css',

                }
            ]
        }
        },

    autoprefixer: {

        dev: {  

            options: {
                    browsers: ['last 2 version','> 1%']
                },

                multiple_files: {
                    expand:true,
                    src: 'target/css/*.css',
                    dest: 'target/css/prefixed/'
                }
            }
        },

        watch: {
                less: {
                    files: ['src/main/less/*.less'],
                    tasks: ['less','autoprefixer'],
                    options: {
                        livereload:true,
                        spawn: false
                    }
                }
           }

});

grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-contrib-watch');

//grunt.registerTask('build', []);
grunt.registerTask('dev', ['less','autoprefixer']);
};

For whatever reason, when I call 'grunt dev' it successfully runs autoprefixer, but no "prefixed" folder is created, and no new files are added.

Thanks in advance for any help you can provide.

ScottSmith95 commented 10 years ago

Can you attach a screenshot or give me an idea what kind of folder structure, file naming conventions you are using?

nDmitry commented 10 years ago

Try to run grunt dev -v, what's in the output?

brycepj commented 10 years ago

@ScottSmith95 In the site root, there's a src folder, which contains all of the uncompiled LESS stylesheets, and a 'target' folder, which is where LESS is creating a CSS folder and dumping the compiled (unprefixed) stylesheets. Does that answer your question?

screenshot from 2014-01-23 09 11 54

brycepj commented 10 years ago

@nDmitry Thanks. This is what I see:

Verifying property autoprefixer.dev exists in config...OK
File: [no files]
Options: diff=false, map=false, browsers=["last 2 version","> 1%"]
brycepj commented 10 years ago

So the line "File: [no files]" seems to explain the problem... but I've checked the filepath a thousand times, and can't figure out why the task isn't able to see the files in the CSS output folder.

nDmitry commented 10 years ago

@brycepj ok, the problem is:

multiple_files: {
[...]
}

This is the correct config:

autoprefixer: {
    dev: {  
        options: {
            browsers: ['last 2 version', '> 1%']
         },
         expand:true,
         src: 'target/css/*.css',
         dest: 'target/css/prefixed/'
    }
}

And, if I'm not mistaken, there also should be flatten: true.

brycepj commented 10 years ago

That did it! Thank you so much!!! I really appreciate you taking the time to help me figure this out. It's been such a headache.

Just curious: what is mulitple_files for, if not this situation?

nDmitry commented 10 years ago

@brycepj you're welcome)

Just curious: what is mulitple_files for, if not this situation?

It's just a target (like dev or dist), I named it so in the readme for example purposes, didn't think it will be confusing. Maybe you should check out the Grunt docs to learn about tasks and targets.

brycepj commented 10 years ago

Oh, I see. Thanks again!