Having Trouble with Gulp and AutoPrefixer Integration

I have integrated Gulp into my project and am looking to utilize the autoprefixer feature.

Here is a glimpse of my current gulp file:

// Including gulp
var gulp = require('gulp');
// Including necessary plugins
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var sass = require('gulp-ruby-sass');
var autoprefixer = require('gulp-autoprefixer');
var imagemin = require('gulp-imagemin');
var cache = require('gulp-cache');


// Concatenating & Minifying JS
gulp.task('scripts', function() {
    return gulp.src('js/*.js')
      .pipe(concat('main.js'))
        .pipe(rename({suffix: '.min'}))
        .pipe(uglify())
        .pipe(gulp.dest('build/js'));
});


gulp.task('sass', function() {
    return sass('scss/style.scss', {style: 'compressed'})
    .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        .pipe(rename({suffix: '.min'}))
        .pipe(gulp.dest('build/css'));
});




gulp.task('images', function() {
    return gulp.src('images/**/*')
    .pipe(cache(imagemin({ optimizationLevel: 5, progressive: true, interlaced: true })))
    .pipe(gulp.dest('build/img'));
});


gulp.task('watch', function() {
   // Watching .js files
    gulp.watch('js/*.js', ['scripts']);
   // Watching .scss files
    gulp.watch('scss/*.scss', ['sass']);
   // Watching image files
    gulp.watch('images/*', ['images']);
 });


// Default Task
gulp.task('default', ['scripts', 'sass', 'images', 'watch']);

In the above code snippet, I have a .sass task that performs as expected. Recently, I incorporated the following lines:

.pipe(autoprefixer({
        browsers: ['last 2 versions'],
        cascade: false
    }))

Prior to the minification into a min.css file. Upon running this, everything seemed to be in order. However, after trying to save the following code:

.test{
    transform: scale(.5);
}

I anticipated having the prefixed versions added to my min.css file, but unfortunately, they were not included. Any suggestions on where I might have gone wrong?

Answer №1

You should give this a shot. It has been very effective for me.

.transform(prefixed({
   browserList: ['latest 2 versions', 'safari 5', 'ie 6', 'ie 7', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4']
}))

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Could the absence of an external style sheet for CSS be hindering the execution of my code?

A generous Stack Overflow user provided me with the code you see here and their JSFiddle can be accessed at http://jsfiddle.net/f18513hw/. The code functions properly in JSFiddle. I copied and pasted the code into my Textpad, saved it in my htdocs folder o ...

Customize Colors to Match Background in SASS

I want to design a dynamic tag component in Angular, where users can input a background color and have the font color automatically adjusted to either light or dark based on the specified color. Here's how my component is structured: <span class=& ...

Using the 'active' class in Bootstrap-4 Navbar specifically for the parent element

As I style the navbar in Bootstrap 4, I encounter an issue with dropdown items. Specifically, when I apply the 'active' class to highlight a dropdown item, all sub-items (children) end up with the same highlighting effect. This results in an unap ...

Issue: Compiling Electron using electron-packager

I'm having trouble packaging my ember-electron app using electron-packager. This issue is specific to a Windows electron app running Ember-electron, with ember-cli version 3.11.0 and node version 10.16.0. Previously, everything was functioning correc ...

Material-UI Swipeable Drawer with a see-through design

Any tips on how to apply a 'transparent' style background property to my SwipeableDrawer component from Material UI? I'm having difficulty changing the background directly from my code since the component generates another component in the H ...

Having Trouble Running Ionic on My Windows 7 System

I've been following the steps in the "Getting Started with Ionic" guide, but I'm stuck at step 2 "Start a Project". Whenever I try to create an Ionic project, I encounter an error. Here's what I get: C:\Users\username>ionic sta ...

Leveraging the power of node pkg to generate standalone executables while configuring npm

I have successfully used pkg to create an executable file for my node js application. Everything is working fine in that aspect. However, I am also utilizing the config module to load yaml configuration files based on the environment. During the packaging ...

Picture emerges from the lineup

My dilemma involves repositioning an image within a row > col-md-6. To address this, I devised two classes - .pos1 and .pos2 .pos1 { position: relative; } .pos2 { position: absolute; right: 0px; } However, when applying these classes, the ...

Is there a way to eliminate the number spinner in Angular specifically for certain input fields?

I am facing an issue where I need to remove the numeric spinner from only a few selected inputs. By adding the following code snippet to my styles.scss file, I was able to successfully remove the spinner: /* Chrome, Safari, Edge, Opera */ input[matinput]: ...

Exploring the implementation of if/else statements in Sass/HTML

I need assistance with customizing the appearance of a save button on my form. The button is currently disabled and appears in blue color, but I would like it to change to a different color until all fields within the form are completed. Even though it c ...

unexpected automatic scrolling that occurs when hovering over an element

a sudden scrolling takes effect simultaneously with hovering on an element. What confuses me more is that it does not happen every time I hover over the element but just occasionally or maybe there is a specific scrolling position that I can't see yet ...

What is the best way to adjust the height of an IFrame to match the size of its content?

I attempted to set the height of an IFrame to 100% (similar to setting a <div> to height:auto). I specified the height attribute in the <iframe> tag as 100% and also set the height in the style to 100%, but it doesn't appear to be functio ...

toggle visibility of <li> elements using ng-repeat and conditional rendering

I have an array of color IDs and codes that I'm utilizing with ng-repeat in the <li> tag to showcase all colors. However, I only want to display colors where the color code is less than 10, hiding any colors where the color code exceeds 10. Addi ...

What are some methods for submitting an HTML form to a CSV file?

I've been racking my brain for the past few days trying to find a viable solution to this problem. My project requires 100 individuals to take turns sitting at a computer and filling out a form I created. Each time someone submits their information, ...

Is there a white outline on the Cordova Text Font?

Currently working on a Cordova app where I have encountered an issue with the text display. The problem lies in the white outline surrounding the text, which is not visually appealing. In my code, I have a div with the style attribute background-color: ye ...

Ways to include a right arrow symbol for sub-child items and a downward arrow for child menu options

I have a php form that generates a drop-down menu using php mysql. The current menu is simple, but I would like to enhance it by adding a right arrow for sub-children and a down arrow for child menus using css. Unfortunately, I am unable to modify the css ...

Automatically customizable CSS border thickness

Consider the following example of a div element: <div style="height: 10%; width: 20%; border: 1px solid black"> Div Content </div> The div above has its height and width specified in percentages. I would like the border width to adjust a ...

What is the best way to restrict users from accessing more than 5 Bootstrap Tab-Panes at once?

Users are restricted to opening only a maximum of 5 tab panes, even if there are multiple tab buttons available. If the user tries to click on the 6th tab, an alert message will be displayed. function addTab(title, url){ var tabs=$(".tabs"), tab ...

Creating a mesmerizing parallax effect for your image: A step-by-step guide

Looking for help to create a parallax effect on an image when hovered over. Does anyone have any advice or resources? Feeling frustrated at the moment. Here is an example link for reference: http://codecanyon.net/item/jquery-moving-perspective/full_scre ...

Utilizing CSS classes to namespace pseudo-selectors

After attempting to search on Google, I am struggling to find the right keywords. I'm trying to apply a pseudo-selector only to a specific class. In this scenario, if we remove the specified class, the last Hi should appear in blue. However, my expe ...