Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

filerev: assetsDir glob pattern not applied to js patterns #572

Open
mauron85 opened this issue Jul 7, 2015 · 0 comments
Open

filerev: assetsDir glob pattern not applied to js patterns #572

mauron85 opened this issue Jul 7, 2015 · 0 comments

Comments

@mauron85
Copy link

mauron85 commented Jul 7, 2015

It seems that glob pattern eg: <%= mapilary.outputDir %>/widgets/*/images is only applied to CSS files and NOT when processing JS files.

With following configuration CSS are processed OK, but js file is not replaced with revved version.

Conf:

        usemin: {
            html: ['<%= mapilary.outputDir %>/*.html'],
            js: ['<%= mapilary.outputDir %>/js/*.js'],
            css: [
                '<%= mapilary.outputDir %>/style/*.css',
                '<%= mapilary.outputDir %>/widgets/*/css/*.css'
            ],
            options: {
                assetsDirs: [
                    '<%= mapilary.outputDir %>',
                    '<%= mapilary.outputDir %>/style',
                    '<%= mapilary.outputDir %>/widgets',
                    '<%= mapilary.outputDir %>/widgets/*/images',
                ],
                patterns: {
                    js: [
                        [/(marker.*?\.(?:gif|jpeg|jpg|png|webp|svg))/gm, 'Update the JS to reference marker images']
                    ]
                }
            }
        },

Example js:

    var icons = {
        courier: {
            url: 'marker-brown.png',
            size: new google.maps.Size(61, 64),
            origin: new google.maps.Point(0, 0),
            anchor: new google.maps.Point(10, 32),
            scaledSize: new google.maps.Size(30.5, 32)
        },
        courierSelected: {
            url: 'marker-brown-selected.png',
            size: new google.maps.Size(61, 64),
            origin: new google.maps.Point(0, 0),
            anchor: new google.maps.Point(10, 32),
            scaledSize: new google.maps.Size(30.5, 32)
        },
        pickup: {
            url: 'marker-delivery-pickup.png',
            size: new google.maps.Size(61, 64),
            origin: new google.maps.Point(0, 0),
            anchor: new google.maps.Point(10, 32),
            scaledSize: new google.maps.Size(30.5, 32)
        },
        drop: {
            url: 'marker-delivery-drop.png',
            size: new google.maps.Size(61, 64),
            origin: new google.maps.Point(0, 0),
            anchor: new google.maps.Point(10, 32),
            scaledSize: new google.maps.Size(30.5, 32)
        }
    };

To make it work I had to add explicitly assetDir where revved images are.

                assetsDirs: [
                    '<%= mapilary.outputDir %>',
                    '<%= mapilary.outputDir %>/style',
                    '<%= mapilary.outputDir %>/widgets',
                    '<%= mapilary.outputDir %>/widgets/*/images',
                    '<%= mapilary.outputDir %>/widgets/map/images' // THIS IS REQUIRED, AS GLOB PATTERN ABOVE SEEMS TO BE IGNORED
                ],

Hovewer glob patterns in assetsDir are working when processing CSS.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant