grunt-dom-munger icon indicating copy to clipboard operation
grunt-dom-munger copied to clipboard

options.read() get only needed ones

Open uloco opened this issue 9 years ago • 1 comments

Can I configure the options.read() method to only get me the script tags I want to? If I got it right, I can only get all script tags' src attribute.

uloco avatar Dec 23 '15 09:12 uloco

Yes, you can. You appear to be able to use selectors (Think its XPATH).

e.g. Don't read those items which have data-concat attribute set to false

dom_munger:{
      read: {
        options: {
          read:[
            {selector:'script[data-concat!="false"]',attribute:'src',writeto:'appjs'},
            {selector:'link[rel="stylesheet"][data-concat!="false"]',attribute:'href',writeto:'appcss'}
          ]
        },
        src: 'app/index.html'
      },

securityvoid avatar Jan 24 '17 17:01 securityvoid