uncss / grunt-uncss

:scissors: A grunt task for removing unused CSS from your projects.
MIT License
3.83k stars 175 forks source link

throw err; 3rd party widget [SOLVED] #101

Closed shawnhaigh closed 10 years ago

shawnhaigh commented 10 years ago

Hey there, not sure if it's a bug or not but I just wanted to bring this to light...

uncss works great in my project until I add a Trip Advisor widget, here is the nasty bit of code:

            <div id="TA_rated257" class="TA_rated text-center">
              <ul id="WBUuUvjBTVa8" class="TA_links TIsyTqCvNK3U" >
                <li id="4QRQAJ1blr" class="o0HL7QeQ">
                <a target="_blank" href="http://www.tripadvisor.com/"><img src="http://www.tripadvisor.com/img/cdsi/img2/badges/recommended_en-11424-2.gif" alt="TripAdvisor" /></a>
                </li>
              </ul>
            </div>
            <script src="http://www.jscache.com/wejs?wtype=rated&amp;uniq=257&amp;locationId=1869768&amp;lang=en_US"></script>

error output:

/home/johnsmith/webdev/myproject/node_modules/grunt-jekyll/node_modules/tmp/lib/tmp.js:261
  throw err;
        ^
Error: UnCSS: could not open /home/johnsmith/webdev/myproject/src/stage/en/combo/extreme/data:text/css,@import%20url%28%27%20http%3A/c1.tacdn.com/css2/widget/cdswidFRR-v1250510475a.css%20%27%29%3B
    at /home/johnsmith/webdev/myproject/node_modules/grunt-uncss/node_modules/uncss/lib/lib.js:84:25
    at /home/johnsmith/webdev/myproject/node_modules/grunt-uncss/node_modules/uncss/node_modules/async/lib/async.js:235:13
    at /home/johnsmith/webdev/myproject/node_modules/grunt-uncss/node_modules/uncss/node_modules/async/lib/async.js:118:13
    at Array.forEach (native)
    at _each (/home/johnsmith/webdev/myproject/node_modules/grunt-uncss/node_modules/uncss/node_modules/async/lib/async.js:39:24)
    at async.each (/home/johnsmith/webdev/myproject/node_modules/grunt-uncss/node_modules/uncss/node_modules/async/lib/async.js:117:9)
    at _asyncMap (/home/johnsmith/webdev/myproject/node_modules/grunt-uncss/node_modules/uncss/node_modules/async/lib/async.js:234:9)
    at Object.map (/home/johnsmith/webdev/myproject/node_modules/grunt-uncss/node_modules/uncss/node_modules/async/lib/async.js:212:23)
    at Object.readStylesheets (/home/johnsmith/webdev/myproject/node_modules/grunt-uncss/node_modules/uncss/lib/lib.js:68:18)
    at getCSS (/home/johnsmith/webdev/myproject/node_modules/grunt-uncss/node_modules/uncss/lib/uncss.js:106:16)

If anyone else has run into a similar problem, I would be happy to know what was done to resolve it.

Thanks in advance ~Shawn

shawnhaigh commented 10 years ago

Heh! SOLVED by adding an ignoreSheets in the config ... :

...
ignoreSheets: [
            'http://c1.tacdn.com/css2/widget/cdswidFRR-v1250510475a.css'
          ]
...

hope this help anyone else stumbling upon this issue. Cheers!