Giter VIP home page Giter VIP logo

gulp-cdnify's People

Contributors

andrewkdouglas avatar cagegong2 avatar kaiqigong avatar okhomenko avatar raygesualdo avatar rudijs avatar xhmikosr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gulp-cdnify's Issues

Cdnify relative references

Is there a way to make the plugin work with just relative (not root-relative) links? E.g. src="images/picture.jpg" instead of src="/foo/bar/images/picture.jpg" when referenced from /foo/bar/index.html.

Does not cdnify links in comments

I have script tags within IE conditional comments which are not being cdnified thus:

<!--[if lt IE 9]>
<script src="scripts/polyfills-2796740d48.js"></script>
<style>
    .ng-hide {
        display: none !important;
    }
</style>
<![endif]-->

is not converted.

Support for srcset attributes?

It would be great if the plugin dealt with srcset as well, e.g. <img src="small.jpg" srcset="medium.jpg 1000w, large.jpg 2000w"> or <img src="picture.jpg" srcset="picture-2x.jpg 2x">. Any chance to make it happen? :-)

Backport from grunt-cdnify

Since the original code is heavily copied from there (BTW you should mention this somewhere), we should backport from there.

cdnify a background-url in a ng-style

Hi,

I have a, as showed below a ng-style attribute that changes dynamically a background-img.
image

Gulp-cdnify does not recognize it. What can I do ?

Thanks

change slashes after cdnify

Hi,

I set my sources path to:
<link rel="stylesheet" href="css/main.css">
<script src="js/bundle.js"></script>

after running cdnify:

gulp.src(config.source.index)
    .pipe($.cdnify({
      base: 'http://my.cdn.path-cdn.com/'
    }))
    .pipe(gulp.dest(config.dist.root));

The output:

<link rel="stylesheet" href="http://my.cdn.path-cdn.com\css\main.css">
<script src="http://my.cdn.path-cdn.com\js\bundle.js"></script>

Cdnify style tag's contents

Is there a way to make the plugin work with the code like this:

<div style="background-image: url(/path/to/img.png);">
</div>

thanks!

TypeError: Cannot read property 'start' of undefined

the process is terminated halfway looks like some malformed source file but the stacktrace didn't tell. Anyway I can fix this?

[09:42:46] Changed HTML file: "c:\wamp\www\2.0_dist_tmp\js\couponListAll.e83a3cea.js"
[09:42:46] Changed HTML file: "c:\wamp\www\2.0_dist_tmp\js\date.a7536e5a.js"
[09:42:46] Changed HTML file: "c:\wamp\www\2.0_dist_tmp\js\DOMWindow.509189ec.js"
c:\wamp\www\node_modules\gulp-cdnify\node_modules\soup\lib\soup.js:62
if (correspondingOpeningTag.start === 1 && _this._string.charAt(1) !
^
TypeError: Cannot read property 'start' of undefined
at Object.htmlparser.Parser.onclosetag (c:\wamp\www\node_modules\gulp-cdnify\node_modules\soup\lib\soup.js:62:38)
at Parser.onend (c:\wamp\www\node_modules\gulp-cdnify\node_modules\soup\node_modules\htmlparser2\lib\Parser.js:274:14)
at Tokenizer.end (c:\wamp\www\node_modules\gulp-cdnify\node_modules\soup\node_modules\htmlparser2\lib\Tokenizer.js:813:12)
at Parser.end (c:\wamp\www\node_modules\gulp-cdnify\node_modules\soup\node_modules\htmlparser2\lib\Parser.js:306:18)
at Soup.module.exports.Soup._build (c:\wamp\www\node_modules\gulp-cdnify\node_modules\soup\lib\soup.js:81:12)
at Soup.module.exports.Soup.setAttribute (c:\wamp\www\node_modules\gulp-cdnify\node_modules\soup\lib\soup.js:110:10)
at DestroyableTransform._transform (c:\wamp\www\node_modules\gulp-cdnify\index.js:119:26)
at DestroyableTransform.Transform._read (c:\wamp\www\node_modules\gulp-cdnify\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:184:10)
at DestroyableTransform.Transform._write (c:\wamp\www\node_modules\gulp-cdnify\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:172:12)
at doWrite (c:\wamp\www\node_modules\gulp-cdnify\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:237:10)

Process finished with exit code 1

Set up tests

The repo needs tests, otherwise we are living on the edge :P

CDNify <picture> element

The module currently doesn’t affect URLs in <picture> element. Would be great if that was added to the functionality.

Edit: Doesn't affect the srcset attribute within <picture> element.

CDNify fails where option html is not defined

The default sources are not applied so that without sources explicitly given in the options object cdnify fails to change any urls.

Thus this passes:

pipe($.cdnify({
  base: 'http://cdn.com/',
  html: {
    'img[src]': 'src',
    'link[rel=stylesheet]': 'href',
    'script[src]': 'src',
    'video[poster]': 'poster',
    'source[src]': 'src'
  }
}));

And this fails:

pipe($.cdnify({
  base: 'http://cdn.com/'
}));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.