GithubHelp home page GithubHelp logo

grunt-postcss's People

Contributors

ai avatar danyshaanan avatar gijsroge avatar janzelc avatar jdforrester avatar kuborgh-bzoerb avatar ndmitry avatar ntwb avatar rarila avatar rvock avatar soul-wish avatar sparanoid avatar vladikoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grunt-postcss's Issues

Doesn't appear to be doing anything?

Hi,

I've used grunt-autoprefixer in the past without any issues, figured I'd try postcss-autoprefixer.

I've installed:
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]

my grunt task configuration:

    sass: {
        dist: {
            files: {
                '<%= yeoman.app %>/styles/main.css' : '<%= yeoman.app %>/styles/scss/main.scss'
            }
        }
    },
    postcss: {
        options: {
            map: true,
            processors: [
                require('autoprefixer-core')({
                    browsers: ['last 2 versions', 'ie 8', 'ie 9']
                })
            ]
        },
        dist: {
            src: '<%= yeoman.app %>/styles/main.css'
        }
    },

and I am invoking the task inside of a grunt watch task like so:

        sass: {
            files: ['<%= yeoman.app %>/styles/scss/**/*.scss'],
            tasks: ['sass', 'postcss:dist']
        },

CLI states:

    Running "postcss:dist" (postcss) task
    >> 1 processed stylesheet created.
    >> 1 sourcemap created.

however, when I inspect my element (in this case, an anchor with a transition property), nothing has been prefixed. It's just the plain old transition.

Any ideas?

multiple srcs not working - only uses last src?

I'm having a weird issue and think I must be doing something wrong, but I can't figure it out, so maybe it is an issue with this plugin. I have the postcss config below and postcss:sass works fine, but postcss:async does not. Basically when target/main/css/async/**/*.css matches a file, src/main/webapp/css/async.css contains the processed version of only that file. deleting the file lets src/main/webapp/css/async.css be the processed version of src/main/css/async/**/*.css. What's happening here? Does postcss not support multiple srcs?

    postcss: {
        options: {
            processors: [
                require('autoprefixer-core')({browsers: '> 1%'}),
                require('csswring')
            ]
        },
        sass: {
            files: {
                //i can simplify this with http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically rename option but it's not worth it as it makes it less legible
                'src/main/webapp/css/ie.css': 'target/main/css/ie.css',
                'src/main/webapp/css/print.css': 'target/main/css/print.css',
                'src/main/webapp/css/screen.css': 'target/main/css/screen.css'
            }
        },
        async: {
            src: ['src/main/css/async/**/*.css', 'target/main/css/async/**/*.css'],
            dest: 'src/main/webapp/css/async.css'
        }
    },

Use PostCSS 5.0

Tomorrow many plugin for 5.0 API will be released, so we need to update runners.

No "postcss" targets found error from Grunt

This is my config

      postcss: {
        options: {
          processors: [
            require('autoprefixer')({browsers: 'last 2 versions'}) // add vendor prefixes
            //require('postcss-simple-vars')({variables: fuji}) // minify the result
          ]
        },
        dist: {
          src: 'css/header.css'
        }
      }

Running grunt postcss is giving this error

grunt postcss
>> No "postcss" targets found.
Warning: Task "postcss" failed. Use --force to continue.

Aborted due to warnings.

What am I doing wrong ?

Incomplete dependencies?

Is there a reason why autoprefixer-core and csswring have to be installed explicitly instead of just having them in dependency descriptor?

Clarify examples

There are several examples in two different readme and for me was not clear to which one I should stick.

autoprefixer Readme:

module.exports = function(grunt) {
    require('grunt-postcss')(grunt);

    grunt.initConfig({
        postcss: {
            options: {
                map: true,
                processors: [
                    require('autoprefixer-core')({
                        browsers: ['last 2 versions']
                    })
                ]
            },
            dist: {
                src: 'css/*.css'
            }
        }
    });

    grunt.registerTask('default', ['postcss:dist']);
};

grunt-postcss readme example:

grunt.loadNpmTasks('grunt-postcss');
grunt.initConfig({
  postcss: {
    options: {
      map: true, // inline sourcemaps

      // or
      map: {
          inline: false, // save all sourcemaps as separate files...
          annotation: 'dist/css/maps/' // ...to the specified directory
      },

      processors: [
        require('pixrem')(), // add fallbacks for rem units
        require('autoprefixer-core')({browsers: 'last 2 versions'}), // add vendor prefixes
        require('cssnano')() // minify the result
      ]
    },
    dist: {
      src: 'css/*.css'
    }
  }

One example is using require statement (which looks just wrong) for getting the grunt-postcss module, the other only load the NpmTask.

Cannot read property 'length' of undefined Use --force to continue.

I believe this error after trying to sort it out for well over an hour is actually related to a bug in the most recent version of autoprefixer and autoprefixer-core but it pops up in grunt as you try to run the prefixing task.

Running "postcss:dist" (postcss) task
Warning: Cannot read property 'length' of undefined Use --force to continue.

All of the following combinations fail to work using the below script

postcss: {
            options: {
                processors: [
                    autoprefixer({ browsers: ['last 2 version'] }).postcss
                ]
            },
            dist: {
                src: './dist/css/*.css',
                dest: './dist/css'
            }
        },

^ That fails, as does, dist: { src: './dist/css/*.css' }, as does

dist: {
                    './dist/css/file1.css': './dist/css/file1x.css',
                    './dist/css/file2.css': './dist/css/file2x.css'
            }

Except the last example does not actually cause an error.

Issue saving to a different directory

I have files like:

- artifacts/
    - css/
        - main.css
        - components/
            - example.css

And I'm trying to save the transformed versions to a different folder, but it's copying the entire source tree structure.

postcss: {
    dev: {
        expand: true,
        src: 'artifacts/css/**/*.css'
        dest: 'release/css/'
    }
}

Should look like:

release/css/main.css
release/css/components/example.css

But instead looks like

release/css/artifacts/css/main.css
release/css/artifacts/css/components/example.css

What am I doing wrong here?

grunt-postcss does not respect seperate tasks (ie 'postcss:dev' and 'postcss:dist')

with the following task configuration:

postcss: {
    dev: {
        options: {
            map: true,
            processors: [
                require('autoprefixer')({browsers: ['last 3 versions', 'ie 8', 'ie 9']}),
                require('pixrem')() // add px fallback for rem units
            ]
        }
    },
    dist: {
        options: {
            map: false,
            processors: [
                require('autoprefixer')({browsers: ['last 3 versions', 'ie 8', 'ie 9']}),
                require('pixrem')(), // add px fallback for rem units
                require('cssnano')() // minify the result
            ]
        }
    }
}

the dist task is always executed, even when explicitly running grunt postcss:dev. same issue as #35 .

processors issue: Autoprefixer

I tried to open this ticket in postcss/autoprefixer, but they told me to open here.

grunt task:

I've some difficult to run autoprefixer with grunt-postcss!
All works fine if I don't call autoprefixer with options, ex:

options: {
      map: false,
      processors: [
        autoprefixer
      ]
    }

I've a problem when I do the following:

options: {
      map: false,
      processors: [
        autoprefixer({ browsers: [ 'last 2 versions' ] /*, ecc... */ })
      ]
    }

running grunt postcss --verbose I obtain:

Options: processors=[null], map=false, diff=false, safe=false

and, of course, nothing happens to my css!

Can anyone help me?

Error: require' is not defined

Hi!

I've been using autoprefixer for quite some time, then I tried to move towards postcss, although I'm facing a problem with "require":

The postcss task:

    postcss: {
      options: {
        map: true,
        processors: [
          require('autoprefixer')({browsers: 'last 2 versions'}), // add vendor prefixes
          require('pixrem')(), // add fallbacks for rem units
        ]
      },
      dist: {
        src: 'css/*.css',
      },
    }

It returns the following errors:

   Gruntfile.js
     66 |          require('autoprefixer')({browsers: 'last 2 versions'}), // add vendor prefixes
                   ^ 'require' is not defined.
     67 |          require('pixrem')(), // add fallbacks for rem units
                   ^ 'require' is not defined.

Appreciate your help!

Multitasks share processors

If you have multiple postcss-tasks, the processors will be appended and shared between tasks.

Example Config:

{
    postcss: {
        doubler: {
            options: {
                processors: [
                    function(css) {
                        css.eachDecl(function (decl) {
                            decl.parent.prepend(decl.clone());
                        });
                    }
                ],
            },
            src: 'test.css',
            dest: 'test-added.css'
        },
        none: {
            options: {
                processors: [],
            },
            src: 'test.css',
            dest: 'test-none.css'
        }
    }
}

test.css

body {color: black;}

The resulting css-files:
test-added.css

body {color: black;color: black;}

test-none.css

body {color: black;color: black;}

test-none.css should be the same as test.css because no processors are listed.

Confusion on browsers option

The usage and options are similar with grunt-autoprefixer (except browsers option).

Can you elaborate on what you mean by "except browsers option"? The wording's a little confusing. Can you still use the browerslist file? Can you still use an ['array', 'list']`?

Thanks!

Processing sourceMaps

Hey @nDmitry

I'm already using PostCSS for autoprefixing and px fallback for rems, but it's been suggested that PostCSS might be able to solve my sourceMap related issue.

At the moment, I'm using grunt-sass to generate both my initial .css files and their accompanying sourceMaps. However, when I use grunt-contrib-cssmin to minify my .css files, the sourceMaps are no longer accurate as a result.

At the moment I have the following:

grunt-sass

options: {
      sourceMap: true,
      sourceMapContents: true,
      // sourceMapRoot: 'assets/css',
      style: 'compressed'
    },

grunt-postcss

options: {
    map: {
      'prev': '<%= siteInfo.assets_path %>/<%= siteInfo.css_dir %>/',
      'inline': false,
      'sourcesContent': true,
    }
},

Everything else is as it should be in terms of src/dest paths etc.

I'm finding that the sourceMap file generated by PostCSS is no different to the original.

Furthermore, if I uncomment sourceMapRoot in my grunt-sass config, PostCSS throws the following fatal error:

Fatal error: "bower_components/normalize-scss/_normalize.scss" is not in the SourceMap.

Having sourceMapRoot on was crucial to me getting sourceMaps working with unminified CSS, so I fear this could be the showstopper?

So my questions are:

  1. Am I barking up the wrong tree here with regards getting an updated sourceMap that accurately reflects the minified CSS?

  2. Does PostCSS have any sourceMapRoot equivalent or workaround to prevent this error?

Thanks folks.

peerDependency

I propose to use postcss as peerDependency like grunt.
It seems more consistent with npm 3.

Error: Cannot find module 'autoprefixer-core'

In my project, I run the following:

npm install grunt-autoprefixer --save-dev
npm install grunt-postcss --save-dev

When I add the following to my Gruntfile.js file from the usage example:

grunt.initConfig({
  postcss: {
    options: {
      processors: [
        require('autoprefixer-core')({browsers: 'last 1 version'}).postcss
      ]
    },
    dist: {
      src: 'css/*.css'
    }
  }
});

...I get: Error: Cannot find module 'autoprefixer-core'.

Platform: Windows 7
NodeJS v0.10.18
npm 1.3.8
grunt-cli v0.1.13
grunt v0.4.5

Question about csswring

Thanks for the plugin. Why are you showing csswring as part of the code? I didn't want all my code minified and it took a while to figure things out. Also, I like using the diff feature, but with csswring, the diff feature doesn't work.

Thanks

browsers error

with autoprefixer i used to have this configuration

browsers : ['> 5%', 'last 2 version', 'ie 8', 'ie 9']

this doesn't work anymore, it gives an error. for example if I want support IE9, i write

require('autoprefixer-core')({browsers: 'last 2 version','ie9'}),

but it gives me an error:
>> SyntaxError: Unexpected token }

how do I add more browsers in the gruntfile now?
thanks! :)

cssnext PostCSS plugin

I'm trying to use this with the cssnext PostCSS plugin, but failing. Any ideas?

grunt.initConfig({
  postcss: {
    options: {
      map: true,
      processors: [
        require('cssnext')(),
        require('autoprefixer-core')({browsers: 'last 1 version'}).postcss,
        require('csswring').postcss
      ]
    },
    dist: {
      src: 'css/*.css'
    }
  }
});

Running this task throws this:

Warning: Property '0' of object [object Object] is not a function

Cross-posting: MoOx/postcss-cssnext#50

grunt.template not working

I am trying to specify paths for postcss-assets with my variables but with no luck:


require('postcss-assets')({
    loadPaths:['<%=yeogurt.client%>/images/'],
    basePath:'<%=yeogurt.client%>/',
    cachebuster:true
})
Warning: /Users/grawl/sites/***/dist/style.css:372:5: Asset not found or unreadable: inline/icon-key-minor.png
Load paths:
  /Users/grawl/sites/***/<%=yeogurt.client%>
  /Users/grawl/sites/***/<%=yeogurt.client%>/<%=yeogurt.client%>/images� Use --force to continue.

Task targets don't seem to be working

I am not being able to specify, two tasks for this plugin.

For example, this is working.

postcss: {
  options: {},
  files: {}
}

But this is not:-

postcss: {
   dev: {
     options: {},
     files: {}
    },
    build: {
       options: {},
       files: {}
    }
}

When the second option is run, its unable to find the source file.

no merging for existing sourcemap

{
    options:
    {
        sourceMap: true,
    }
}

this code generate my css sourcemap. if is activate the postcss sourcemap it will merge the existing sourcemap with the postcss-generated. this is a problem because the postcss-generated overwrite the other mappings because the postcss use the concated file again. it only works if i use inline. but i dont want use inline.

here are the my gruntfile

concat:
{
    options:
    {
        sourceMap: true
    },  
    stylesheet: grunt.file.readJSON('application/asset/stylesheet.json'),
    javascript: grunt.file.readJSON('application/asset/javascript.json')
},
postcss:
{
    options:
    {
        map:
        {
            inline: false
        },
        processors:
        [
            require('autoprefixer-core')(
            {
                browsers: 'last 2 version'
            }),

            require('postcss-simple-vars')(),
            require('cssnano')()
        ]
    },

    dist:
    {
        src: '<%= application.destination.stylesheet %>**/*.css'
    }
}

if i run only concat, my sourcemap looks like this

{"version":3,"sources":["../../application/asset/stylesheet/dispendium-reset.css","../../application/asset/stylesheet/dispendium-grid.css","../../application/asset/stylesheet/dispendium-stylehelper.css","../../application/asset/stylesheet/button.css","../../application/asset/stylesheet/main.css"]...

only the source files are in the sources array.

but if i can postcss the sourcemaps looks like this

{"version":3,"sources":["application.css","../../application/asset/stylesheet/dispendium-reset.css","../../application/asset/stylesheet/dispendium-grid.css","../../application/asset/stylesheet/dispendium-stylehelper.css","../../application/asset/stylesheet/button.css","../../application/asset/stylesheet/main.css"]

the application.css is the concated css file and not a source file!

migrating to postcss from autoprefixer

I'm migrating that task due to deprecation of autoprefixer, but it is not working when dist is not one file but something like I had before:

            dist: {
                files: [
                    {
                        expand: true,
                        cwd: ".tmp/styles/",
                        src: "{,*/}*.css",
                        dest: ".tmp/styles/"
                    }
                ]
            },

Postcss only reads last file in array of sources (src:)

postcss: {
options: {
map: true,
processors: [
require('postcss-nesting')({ /* options */ }),
require('pixrem')(), // add fallbacks for rem units
require('autoprefixer-core')({browsers: 'last 3 versions'}), // add vendor prefixes
require('cssnano')() // minify the result
]
},
dist: {
src: ['css/abc.css', 'css/slick.css', 'css/slick-theme.css'],
dest: 'build/css/app.css'
}
},

Cannot read property 'postcssVersion' of undefined

module.exports = function(grunt) {

  grunt.initConfig({

    postcss: {
      options: {
        map: true,
        processors: [
          require('lost')().postcss
        ]
      },
      dist: {
        src: 'src/css/style.css',
        dest: 'dist/css/style.css'
      }
    }

  });

  grunt.loadNpmTasks('grunt-postcss');

  grunt.registerTask('default', ['postcss']);

};

https://github.com/corysimmons/lost

Works fine with Gulp. Not sure why it fails with grunt-postcss.

failOnError not working

failOnError introduced in v0.7.0 is not working for me (writeDest works as expected though)

I cannot get failOnError to actually fail the grunt task:

The results:

$ grunt postcss:hack
Running "postcss:hack" (postcss) task

src/wp-includes/css/wp-pointer.css
4:2 ⚠  Unexpected property "arin" (property-whitelist) [stylelint]
4:9 ⚠  Unexpected unit on zero length number (number-zero-length-no-unit) [stylelint]

>> 1 stylesheet processed, no files written.

Done, without errors.

The Grunt task grunt postcss:hack I'm using:

        postcss: {
            options: {
                failOnError: true,
                processors: [
                    autoprefixer({
                        browsers: ['Android >= 2.1', 'Chrome >= 21', 'Explorer >= 7', 'Firefox >= 17', 'Opera >= 12.1', 'Safari >= 6.0'],
                        cascade: false
                    })
                ]
            },
            hack: {
                options: {
                    failOnError: true,
                    writeDest: false,
                    syntax: require('postcss-scss'),
                    parser: require('postcss-safe-parser'),
                    processors: [
                        require('stylelint'),
                        require('postcss-reporter')({clearMessages: true})
                    ]
                },
                expand: true,
                cwd: SOURCE_DIR,
                dest: SOURCE_DIR,
                src: [
                    'wp-includes/css/wp-pointer.css'
                ]

SourceMap's inline/external issue

First setup:
If I compile my SCSS files, then cssmin then postcss, if you have the map option set to true, it does not put the map inline, it keeps it external.

Now if I switch the cssmin task and postcss, it does put the sourcemap inline. If I have it set like this second example to inline false, then the sourcemap generates, but the sourcemap linking within the css file is not there. I'm able to get it working how I want, but I'm a little confused as to why when it's set to inline it does not put it inline, or why it doesn't like it to the external sourcemap if inline is set to false. Maybe I'm missing something? Any info/help would be appreciated. Thank you.

My Gruntfile:

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    cssmin: {
      options: {
        shorthandCompacting: false,
        roundingPrecision: -1,
        sourceMap: true,
      },
      target: {
        files: {
          'web/assets/css/main.min.css': ['web/assets/css/main.min.css']
        }
      }
    },
    postcss: {
      options: {
        map: true,
        processors: [
        require('autoprefixer-core')({browsers: ['opera 12', 'ff 15', 'chrome 25', 'ie 8', 'ie 9', 'ie 10', 'ie 11']})
        ]
      },
      dist: {
        src: 'web/assets/css/main.min.css'
      }
    },
    scsslint: {
      allFiles: ['<%= watch.css.files %>'],
      options: {
        config: '.scss-lint.yml',
        colorizeOutput: true,
        compact: true,
        force: true,
      },
    },
    sass: {
      dev: {
        options: {
          style: 'expanded',
          precision: 10,
        },
        files: [{
          expand: true,
          cwd: 'web/assets/scss',
          src: 'main.scss',
          dest: 'web/assets/css',
          ext: '.min.css',
        }],
      }
    },
    watch: {
      options: {
        livereload: true,
        spawn: false,
      },
      css: {
        files: ['web/assets/scss/**/*.scss'],
        tasks: ['newer:sass:dev', 'cssmin', 'newer:postcss'],
      },
      scsslint: {
        files: ['web/assets/scss/main.scss', 'web/assets/scss/components/_components.scss'],
        tasks: ['newer:scsslint:allFiles'],
      },
    },
  });

  // ------------------------------------------------------- LOAD TASKS //
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-newer');
  grunt.loadNpmTasks('grunt-postcss');
  grunt.loadNpmTasks('grunt-scss-lint');

  // ------------------------------------------------------- REGISTER TASKS //
  grunt.registerTask('default',['watch']);
}

Grunt subtasks not supported?

Either I'm totally screwing this up, or subtasks are not supported with this plugin.

For example, the following pattern works fine for every other grunt task I've used:

  config.stylus = {}
  config.stylus.affiliate =
    options:
      compress:      off
      linenos:       on
      'include css': on
      'resolve url': on
      paths:         ["public/affiliate_items"]
    files: {}
  config.stylus.affiliate.files["public/affiliate_items/build/main.css"] = \
    "public/affiliate_items/main.styl"
  config.stylus.affiliate.files["public/affiliate_newsletters/build/main.css"] ="public/affiliate_newsletters/main.styl"

In this case the stylus object is the subtask definition. I can call it with grunt stylus:affiliate. Here's my postcss grunt task config:

  config.postcss =
    options:
      map: yes
    affiliate_items:
      options:
        processors: [autoprefixer().postcss]
      dist: src: 'public/affiliate_items/build/*.css'
  config.postcss.affiliate_newsletters =
    options:
      processors: [
        autoprefixer(
          browsers: ['> 1%', 'last 4 versions', 'Firefox ESR', 'Opera 12.1']
        ).postcss
      ]
    dist: src: 'public/affiliate_newsletters/build/*.css'

With this, calling grunt postcss:affiliate_items or grunt postcss:affiliate_newsletter fails silently.

Am I totally messing something or does this task just not support sub-tasks?

Option to not produce transformed files

Right now the basic functionality of PostCSS where no files are produced is not exposed in grunt-postcss.

I'd like to use this task in combination with stylelint as a linter. It would be useful to not have it unconditionally write to disk.

This would essentially allow users to configure grunt-postcss similar to AtomLinter/linter-stylelint.

Error with autoprefixer-core 5.2.0

Before creating this issue, I noticed that autoprefixer-core 5.2.0 was just released about 8 hours ago. Hopefully I'm not just jumping the gun here and it's just a dependency thing or something. I'm woefully unequipped to troubleshoot errors with Node modules, but would love to contribute.

That said, it seems when using 5.2.0 I'm getting a "undefined" error when Grunt gets to the postcss processors.

I tried it both ways:

var autoprefixer = require('autoprefixer-core');
...
processors: [
  autoprefixer({browsers: ['last 2 version', 'ie 9']}).postcss
]
processors: [
  require('autoprefixer-core')({browsers: ['last 2 version', 'ie 9']}).postcss
]

Both result in Fatal error: undefined is not a function

When switching back to autoprefixer-core 5.1.x, Grunt runs properly.

error : (node) warning: Recursive process.nextTick detected.

Hi! I'm new to postcss & autoprefixer. I'm trying to run a basic single process.

Here's my declaration for postcss in grunt :

     postcss: {
        options: {
            processors: [
                require('autoprefixer-core')({browsers: 'last 1 version'})
            ]
        },
        dist: {
            src: 'homepage/static/stylesheets/test.css'
        }
    },

i register the single task:
grunt.registerTask('postcss', ['postcss']);

My test CSS looks like
a { background:yellow; }

however when i run the task 'grunt postcss' I see:

(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.  
util.js:35
var str = String(f).replace(formatRegExp, function(x) {
                  ^
RangeError: Maximum call stack size exceeded

How can I get around this? thanks!

Fatal error: Cannot read property 'split' of undefined

I keep getting the error mentioned above when compiling. If I comment out "require('cssnano')()" the build works fine. Nothing has changed in my grunt fine and was working properly up until an hour ago..Any thoughts?

Using external "browserlist" file

Is there any way that we can use an external "browserlist" file in the projects root folder ?
When setting no options for autoprefixer-core, the default browser list is being used instead of this file.

Setting source map destination path

postcss's documentation states:

By default, PostCSS presumes that you want to save the source map as opts.to + '.map' and will use this path in the annotation comment. But you can set another path by providing a string value for annotation.

Setting option.map.annotation adds a comment with that path to the source map as expected.

That setting is ignored by grunt-postcss and it is always written to destination plus .map.

It would be great to adopt the postcss behavior to be consistent and to allow sourcemaps in different locations than the stylesheet. 😄

v0.6.0 shows PostCSS deprecated warnings

After upgrading to v0.6.0 from v0.5.4 PostCSS a bunch of deprecated warnings are shown.

Container#eachInside is deprecated. Use Container#walk instead.
Node#between is deprecated. Use Node#raws.between
Rule#_selector is deprecated. Use Rule#raws.selector
Node#_value was deprecated. Use Node#raws.value
Node#_important was deprecated. Use Node#raws.important
Container#eachAtRule is deprecated. Use Container#walkAtRules instead.
Container#eachRule is deprecated. Use Container#walkRules instead.
Container#eachDecl is deprecated. Use Container#walkDecls instead.
Node#before is deprecated. Use Node#raws.before
Node#after is deprecated. Use Node#raws.after
Node#semicolon is deprecated. Use Node#raws.semicolon

I only see a subset of the above warnings, the above list was taken from the last grunt-postcss Travis CI job here: https://travis-ci.org/nDmitry/grunt-postcss/jobs/76824445

My Gruntfile.js I tested this with -> https://core.trac.wordpress.org/browser/trunk/Gruntfile.js

This also relates to this issue (I think) stylelint/stylelint#363

1 processed stylesheet created

Great grunt task so thanks for this.

Not sure if this is designed behavior or not, but I have three .css stylesheets the public/css/ directory, and all three are being processes, however, the console output only ever says '1 processed stylesheet created'.

postcss: {
      options: {
        map: false,
        processors: [
          require('pixrem')(), // add fallbacks for rem units
          require('autoprefixer-core')({browsers: 'last 2 versions'}),
          require('cssnano')() // minify the result
        ]
      },
      dist: {
        src: 'public/css/*.css'
      }
    }

How to define multiple tasks?

I'd like to define two postcss tasks with different files and different configs. I thought it would work like in grunt docs. So I created a modernand an ancientsubtask:

module.exports = (grunt) ->
  grunt.initConfig
    postcss:
      modern:
        options:
          processors: [
            require('autoprefixer-core')(browsers: 'last 2 versions')
            require('cssnano')()
          ]
        dist: src: 'modern.css'
      ancient:
        options:
          processors: [
            require('autoprefixer-core')(browsers: 'ie 6-8')
            require('cssnano')()
          ]
        dist: src: 'ancient.css'

But unfortunately they wont be executed like that. What should I do?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.