grunt-contrib-cssmin

Avoid Grunt cssmin task to remove duplicate entries

不打扰是莪最后的温柔 提交于 2020-01-13 03:12:11
问题 In my Gruntfile I'm using cssmin (grunt-contrib-cssmin) task. Something like: cssmin: { css : { src: "dist/styles.css", dest: "dist/styles.min.css" } } The problem is: styles.css is generated with a concat task that concatenates lots of .css files. In some of files I have the same css selector (example: .panel a) Only the first one selector is kept bu the cssmin task, all others are removed. I guess it's a default behaviour of the task. Is there a way to keep duplicated selectors? 回答1: Grunt

Handle dependent files with Grunt and rewrite paths

邮差的信 提交于 2020-01-03 05:55:06
问题 This is my Gruntfile.js ( assets is the Bower folder): module.exports = function(grunt) { grunt.initConfig({ distFolder: 'dist', pkg: grunt.file.readJSON('package.json'), concat: { options: { separator: ';', }, dist: { src: [ 'assets/jquery/dist/jquery.js', 'assets/jquery-ui/ui/jquery-ui.js', 'assets/jsplumb/dist/js/jquery.jsPlumb-1.5.5.js' ], dest: '<%= distFolder %>/main.js', }, }, uglify: { dist: { src: 'dist/main.js', dest: 'dist/main.min.js', }, }, cssmin: { combine: { files: { 'dist

Grunt cssmin / CleanCSS source map rebasing

不打扰是莪最后的温柔 提交于 2019-12-24 00:57:45
问题 I'm using cssmin with the following "Content" folder structure: src |--dir1 | |--style1.css | |--images | |--image1.png |--dir2 |--style2.css |--images |--image2.png dist |--styles.min.css |--styles.min.css.map Where styles.min.css and styles.min.css.map are the result of concatenating/minifying all stylesheets in the"src" folder. I first had issues where styles.min.css contained URLs for images in the wrong places (i.e. "images/image1.png" instead of "../src/dir1/images/image1.png") but

Use clean-css compatibility options in grunt-contrib-cssmin

流过昼夜 提交于 2019-12-23 04:27:03
问题 I ran into an issue with clean-css in IE10. I'm needing to turn off the spaces after closing braces optimization. I'm using the grunt-contrib-cssmin plugin to automate all these optimizations, but I don't see a way to access the compatibility flags from within this plugin. Has anyone been able to target the compatibility settings of clean-css from the grunt-contrib-cssmin plugin? 回答1: Ran into this same issue yesterday, and found the solution here: https://github.com/gruntjs/grunt-contrib

grunt-contrib-css is breaking my CSS b.c. it removes multiple entries …?

心不动则不痛 提交于 2019-12-11 12:51:50
问题 ... should I file this as a bug. w/out using it my code works. When I use it I loose some of my stylings. After looking into it further, it is deleting multiple definitions of classes. Also, someone with a similar problem here - Avoid Grunt cssmin task to remove duplicate entries I have the same class defined 4 times for each browser. The browsers know which one to use b.c. of the browser extensions. Is there a way to tell it not to do this: Here is the Gruntfile.js cssmin: { options: {

How do we set a target in a grunt cssmin task?

筅森魡賤 提交于 2019-12-05 00:31:54
问题 I am trying out cssmin for Grunt According to the docs targets can be defined "according to the grunt Configuring tasks guide." When I create a cssmin task using that pattern, like: cssmin: { my_target: { minify: { src: 'path-to/default.css', dest: 'path-to/default.min.css' } } } the minified file is not created. If I remove the target level it works as expected. Do I do something wrong here? or are there other options than cssmin (In my research I picked this as everybody was pointing to it)

grunt-contrib-cssmin - how to remove comments from minified css

☆樱花仙子☆ 提交于 2019-12-04 16:42:56
问题 Im using cssmin to minify css files. my config like this: module.exports = function(grunt) { grunt.config.set('cssmin', { site: { src: ['.tmp/public/concat/site.css'], dest: '.tmp/public/min/site.min.css' } }); grunt.loadNpmTasks('grunt-contrib-cssmin'); }; But output minified css files has comments. Is it possible to configure cssmin to remove comment from source css files? Thank you. 回答1: Set keepSpecialComments to zero, for removing all comments. grunt.config.set('cssmin', { options: {

Avoid Grunt cssmin task to remove duplicate entries

旧巷老猫 提交于 2019-12-04 08:17:44
In my Gruntfile I'm using cssmin (grunt-contrib-cssmin) task. Something like: cssmin: { css : { src: "dist/styles.css", dest: "dist/styles.min.css" } } The problem is: styles.css is generated with a concat task that concatenates lots of .css files. In some of files I have the same css selector (example: .panel a) Only the first one selector is kept bu the cssmin task, all others are removed. I guess it's a default behaviour of the task. Is there a way to keep duplicated selectors? Grunt cssmin has a dependency on node.js module clean-css. I would recommend to use clean-css API within Grunt

cssmin not correctly handling @import

牧云@^-^@ 提交于 2019-12-03 17:13:10
问题 I am using cssmin on files containing @imports. cssmin is recursively importing local files correctly, but for imports that point to a URL the imports are left inline. This makes the resulting minified CSS invalid because @ rules must be at the beginning of the file. Does anyone know a good solution or workaround to this problem? 回答1: I have exactly the same problem with cssmin and @import , and i found a solution with grunt concat : Create a concat grunt task that: Put @import url in the

How do we set a target in a grunt cssmin task?

丶灬走出姿态 提交于 2019-12-03 16:28:23
I am trying out cssmin for Grunt According to the docs targets can be defined "according to the grunt Configuring tasks guide." When I create a cssmin task using that pattern, like: cssmin: { my_target: { minify: { src: 'path-to/default.css', dest: 'path-to/default.min.css' } } } the minified file is not created. If I remove the target level it works as expected. Do I do something wrong here? or are there other options than cssmin (In my research I picked this as everybody was pointing to it) Using: grunt v0.4.1 cssmin v0.6.0 Your configuration is just a little off. minify is also just a