tactivos / grunt-cdn

79 stars 53 forks source link

Either plugin doesn't work or I'm really confused #18

Open altano opened 11 years ago

altano commented 11 years ago

Either plugin doesn't work or I'm really confused:

cdn:html - asdf.html
skipping /favicon.ico it's a relative URL
skipping /images/favicon.png it's a relative URL
skipping /stylesheets/616c.rails-consulting-screen.css it's a relative URL
skipping /stylesheets/bad8.rails-consulting-print.css it's a relative URL
skipping /stylesheets/vendor/d287.coderay.css it's a relative URL
skipping /images/rails-consulting/logo.png it's a relative URL
skipping /images/rails-consulting/nav_consulting.png it's a relative URL
skipping /images/rails-consulting/nav_ideas.png it's a relative URL
...

What is an absolute URL then? The documentation makes it sound like these URLs are absolute and they should be processed. What am I missing?

altano commented 11 years ago

I looked through the source: it looks like 'flatten' just has to be true or relative URLs are skipped. I'm really confused as that doesn't make sense to me.

Also, options.stripDirs and options.match aren't documented, despite the latter being pretty important. Can I count on them sticking around? If so, maybe I'll document them for you...

johnnyhalife commented 11 years ago

URLs that get CDNified (by default) are those relative. However you can use stripeDirs we'll keep it around as long as you're using it =)

altano commented 11 years ago

URLs that get CDNified (by default) are those relative

Can you give me an example URL that will get CDNified with the default options?

johnnyhalife commented 11 years ago

Sorry, it seems to be a bug there. /static/foo.png should be cdnefied.

I'll check later, if you find the offending line you're welcome to send a PR =). We'll take a look too.

On Sat, Jul 6, 2013 at 8:15 PM, Alan notifications@github.com wrote:

URLs that get CDNified (by default) are those relative

Can you give me an example URL that will get CDNified with the default options?

— Reply to this email directly or view it on GitHubhttps://github.com/tactivos/grunt-cdn/issues/18#issuecomment-20562731 .

altano commented 11 years ago

grunt-cdn.js:104 is the offending line:

if (!options.flatten && !grunt.file.isPathAbsolute(resourceUrl.pathname)) {

I would send you a fix but I don't really understand how options.flatten is supposed to work.