Ideame / grunt-css-urls

Grunt task to make css urls relative to a main css file for bundling
MIT License
15 stars 4 forks source link

Wrong slash in Windows #3

Closed aligin closed 9 years ago

aligin commented 9 years ago

Hello. I have an issue in windows machine. The url rewrites in .\vendor\bootstrap\fonts\glyphicons-halflings-regular.woff2 Suggest to add replacement:

jpgarcia commented 9 years ago

Url replacement are intended to resolve "url" paths not file-system paths, It does not matter if you are running Windows. Could you please give me more context? maybe am I missing something. Closing the issue for now.

aligin commented 9 years ago

So, I describe what i'm doing. Maybe I'm doing wrong... Visual studio, node for windows and so on.

Structure folder is almost like in an example.

|root
|  |-gruntfile.js
|  |-bower.json
|  |-Content
|  |  |-frontend.css
|  |  |-vendor
|  |  |  |-iCheck
|  |  |  |  |-square
|  |  |  |  |  |-blue.css
|  |  |  |  |  |-blue@2x.png

blue.css contains

.iradio_square-blue {
        background-image: url(blue@2x.png);
        -webkit-background-size: 240px 24px;
        background-size: 240px 24px;
    }

frontend.css contains

@import './vendor/iCheck/square/blue.css';

gruntfile.js:

module.exports = function(grunt) {
    grunt.initConfig({
/** prev code here**/
        cssUrls: {
            /* src *(required)*: The file location of the css with the @import rules. */
            src: "Content/frontend.css"
        },
        cssmin: {
            all: {
                files: {
                    './Content/activecontact.min.css': ['./Content/frontend.css']
                }
            }
        },
        copy: {
            main: {
                files: [
                  // iCheck
                  { expand: true, cwd: './bower_components/iCheck/skins/', src: ['**'], dest: './Content/vendor/iCheck/' },

                ]
            }
        }
    });

    grunt.registerTask("css", ["copy:main", "cssUrls", "cssmin"]);

    grunt.loadNpmTasks("grunt-contrib-concat");
    grunt.loadNpmTasks("grunt-contrib-uglify");

    grunt.loadNpmTasks("grunt-contrib-cssmin");
    grunt.loadNpmTasks('grunt-css-urls');
    grunt.loadNpmTasks('grunt-contrib-copy');
};

So. We are copiring files from bower to vendor directory. Then we use cssUrls and we are receiving blue.css that contains

.iradio_square-blue {
        background-image: url(.\vendor\iCheck\square\blue@2x.png);
        -webkit-background-size: 240px 24px;
        background-size: 240px 24px;
    }

bad_request