Giter Site home page Giter Site logo

Comments (9)

TrySound avatar TrySound commented on August 11, 2024

@smlombardi Show log. Show build code.

from gulp-postcss.

smlombardi avatar smlombardi commented on August 11, 2024

Please see https://stackoverflow.com/questions/31944848/trying-to-integrate-gulp-sass-with-gulp-autoprefixer-postcss-failing-miserably

from gulp-postcss.

TrySound avatar TrySound commented on August 11, 2024

@smlombardi Try this

gulp.task('style', function(done) {
  return sass('source', { sourcemap: true })
    .on('error', done)
    .pipe(postcss([autoprefixer({
      browsers: ['last 2 versions']
    })]))
    .on('error', done)
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest('result'))
    .pipe(reload({ stream: true }));
});

from gulp-postcss.

TrySound avatar TrySound commented on August 11, 2024

@smlombardi But if you start new project try to use postcss alternatives like precss or cssnext. You can also combain different plugins and for example use cssnext with nested.

from gulp-postcss.

smlombardi avatar smlombardi commented on August 11, 2024

I get this with the above code:

STARYU:designsystem stevelombardi$ gulp style
[13:54:31] Using gulpfile ~/Documents/designsystem/gulpfile.js
[13:54:31] Starting 'style'...
[13:54:32] gulp-ruby-sass stdout: directory
[13:54:32] gulp-ruby-sass stdout: write design_system.css
      write design_system.css.map
[13:54:32] gulp-ruby-sass stdout: write live_preview.css
      write live_preview.css.map
[13:54:33] 'style' errored after 1.03 s
[13:54:33] TypeError in plugin 'gulp-postcss'
Message:
    object is not a function
STARYU:designsystem stevelombardi$ 

Here, with my paths added:

gulp.task('style', function(done) {
  return sass('app/assets/sass/', {
      sourcemap: true
    })
    .on('error', done)
    .pipe(postcss([autoprefixer({
      browsers: ['last 2 versions']
    })]))
    .on('error', done)
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest('app/assets/css/'))
    .pipe(reload({
      stream: true
    }));
});

from gulp-postcss.

rstuart85 avatar rstuart85 commented on August 11, 2024

I can this same error with the same workflow. Any idea's what is happening here?

from gulp-postcss.

rstuart85 avatar rstuart85 commented on August 11, 2024

For what it is worth, if you remove autoprefixer as a postprocessor, it seems to work.

from gulp-postcss.

TrySound avatar TrySound commented on August 11, 2024

@smlombardi @rstuart85 Show whole code

from gulp-postcss.

rstuart85 avatar rstuart85 commented on August 11, 2024

Fix posted on the stackoverflow question. Essentially, it seems to be down to which package you are using autoprefixer from. This doesn't work (produces the error described):

var autoprefixer = require('gulp-autoprefixer');

This does work (no more error):

var autoprefixer = require('autoprefixer-core');

That's all you need to change. You can test with the code posted above.

from gulp-postcss.

Related Issues (20)

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.