C-Lodder / grunt-postcss

Apply several post-processors to your CSS using PostCSS.
MIT License
39 stars 7 forks source link

Not works with postcss-em-media-query #39

Closed pajinev closed 4 years ago

pajinev commented 4 years ago

Maybe i don´t know how to use it :( Sorry :(

Config jit-grunt and Load-config

module.exports = {

  default: {
    options: {
      map: false,
      processors: [
        require('autoprefixer')({ grid: true }),

          //require('postcss-media-minmax')(),
          require('postcss-em-media-query')(),

          require('postcss-pxtorem')({
              rootValue: 16,
              unitPrecision: 5,
              //propList: ['font', 'font-size', 'line-height', 'letter-spacing', 'padding', 'margin'],
              propList: ['*', '!border*', '!border-left*', '!border-right*', '!border-bottom*', '!border-top*', '!border-radius*'],
              selectorBlackList: [],
              replace: false,
              mediaQuery: false,
              minPixelValue: 0
          }),

          require('cssnano')({
              preset: ['default', {
                  discardComments: true
                  //{
                      //removeAll: true,
                  //},
              }]
          })

      ],

    },
    //src: 'css/style.css',
    //dest: 'css/style.css'
      src: 'css/*.css'
  }
}; // module.exports
C-Lodder commented 4 years ago

Are you getting any errors?

pajinev commented 4 years ago

Yes.... "require is not a function" with old version of postcss-em-media-query v. 2.0.0 works fine... with new version 3.0.0 have error :(

pajinev commented 4 years ago

C-lodder, pls is any ways to install your plugin to root directory node_modules? (jit grunt is very slow with static mappings. :(

C-Lodder commented 4 years ago

The install path is managed by NPM. I've forked the repo and namespaced the package with @lodder, so it will install in that sub-directory.

Jit Grunt was last published 5 years ago and looks like it's no longer maintained.

pajinev commented 4 years ago

I understand....can we look in postcss-em-media-query pls?

C-Lodder commented 4 years ago

I will have a test with it later on today after work

pajinev commented 4 years ago

you are the top!

C-Lodder commented 4 years ago

I've run some tests and it's working absolutely fine:

const { default: postcssEmMediaQuery } = require('postcss-em-media-query')

grunt.initConfig({
    postcss: {
        mediaquery: {
            options: {
                processors: postcssEmMediaQuery
            },
            src: 'path/to/file/mediaquery.css',
            dest: 'dist/style.css'
        },
    },
});
C-Lodder commented 4 years ago

Closing as the solution above works