So I saw that elixir doesn't automatically use autoprefixer. This is how my gulp file looks:
var Elixir = require('laravel-elixir');
var autoprefixer = require('gulp-autoprefixer');
var gulp = require('gulp');
Elixir.config.sourcemaps = false;
gulp.task('sass', function() {
return gulp.src('resources/sass/app.scss')
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest('public/css/app.css'));
});
Elixir(function(mix) {
// Copy bootstrap.min.js to node vendor directory until it becomes a node module
mix.copy('public/vendor/bootstrap-4', 'node_modules/bootstrap-4');
// Combine all vendor scripts
mix.scripts([
'bootstrap-4/dist/js/bootstrap.min.js',
'vue/dist/vue.min.js'
], 'public/js/vendor.js', 'node_modules');
// Combine all files into one single CSS file
mix.task('sass', 'resources/sass/**/*.scss');
// Get rid of cached version
mix.version([
'public/js/vendor.js',
'public/css/app.css'
]);
});
But it's not issuing autoprefixer still. I get no gulp errors. And when I run gulp watch
, it doesn't update whenever I update a .scss file. All my sass files are located under resources/sass
Thanks for any help!
I even tried:
new Task('sass', function() {
return gulp.src('resources/sass/app.scss')
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest('public/css/app.css'));
})
.watch('resources/sass/**/*.scss');
mix.sass()
function you could use instead of creating a new task. Laravel Elixir automatically usesautoprefixer
unless you disable it as well. See the followingGulpfile.js
example: gist.github.com/divspace/3f952754581babb21c5b – Mirage