validator.js icon indicating copy to clipboard operation
validator.js copied to clipboard

[proposal] add CDN option in readme

Open luiscobot opened this issue 6 years ago • 11 comments

Hi, I want to proposal to add cdn instructions in the readme, we can use https://unpkg.com/ In that way, we will have a cdn method to add validator.js in client-side.

Can I make a PR?

luiscobot avatar Oct 28 '20 03:10 luiscobot

Many people are using unpkg to load JS libraries. I really think it's a great idea to add instructions for that purpose specially that validator.min.js will be removed from the repo @ezkemboi @profnandaa any feedback on this?

tux-tn avatar Dec 15 '20 14:12 tux-tn

Sounds good to me, let's do that. Thanks!

profnandaa avatar Dec 17 '20 04:12 profnandaa

Busy working on some work, but here's the address if anyone has time to update the readme. If I can, I'll get to it before end of day.

https://unpkg.com/validator.js@latest/dist/validator.min.js

Edit: Of course I say that, but didn't test that min.js worked for me. Derp.

Brutalbeard avatar Jan 20 '21 18:01 Brutalbeard

In theory, the below should work?

<script type="text/javascript" src="https://unpkg.com/validator.js@latest/dist/validator.min.js"></script>
<script type="text/javascript">
    console.log(validator.isEmail('[email protected]')); //=> true
</script>

Brutalbeard avatar Jan 20 '21 19:01 Brutalbeard

Sure @Brutalbeard. Please if you get sometime later in the day, you can add it. We will appreciate it.

ezkemboi avatar Jan 20 '21 19:01 ezkemboi

@ezkemboi, @profnandaa, @luiscobits or @tux-tn, can anyone just double check that they have no issue bringing this into a basic HTML page?

I'll have a pull request for the readme ready if you give the go ahead.

Brutalbeard avatar Jan 20 '21 19:01 Brutalbeard

Hey all. Just bumping on this. Haven't used unpkg.com before. Thinking there may be some other dependency to add?

@ezkemboi, @profnandaa, @luiscobits, @tux-tn

Brutalbeard avatar Jan 25 '21 18:01 Brutalbeard

Thanks @Brutalbeard!

No, Unpkg do not need anything else, only the link that you pointed out before.

luiscobot avatar Jan 25 '21 20:01 luiscobot

PR on its way!

Brutalbeard avatar Jan 25 '21 20:01 Brutalbeard

Just a head's up: https://unpkg.com/validator.js@latest/dist/validator.min.js does not point to this package.

I think you probably want: https://unpkg.com/validator@latest/validator.min.js

samuelcolburn avatar Jun 21 '21 21:06 samuelcolburn

@Brutalbeard -- sure, looking forward to your PR.

profnandaa avatar Jul 16 '21 17:07 profnandaa