kiltjs / jqlite

Tiny JavaScript DOM query library that uses pure CSS selectors
MIT License
99 stars 19 forks source link

How to use with browserify #27

Closed hoangnguyencong closed 9 years ago

hoangnguyencong commented 9 years ago

I have a snippet code but got error:

var $ = require('jqlite');

var $myNode = $('.my-class');

Uncaught ReferenceError: $ is not defined

Expecting your help.

Best.

jgermade commented 9 years ago

Hi @hoangnguyencong, thanks for reporting this issue. I'll check this soon!

jgermade commented 9 years ago

Hi @hoangnguyencong, now jqlite should work with browserify (jqlite v0.2.15)

Please let me know if doesn't work, and thanks for the feedback!!

hoangnguyencong commented 9 years ago

Hi @jgermade, thank for your helping. I updated latest version. But still not work. I get error when run:

var $ = require('jqlite'); var $myNode = $('.my-class');

Uncaught TypeError: object is not a function .

jgermade commented 9 years ago

Ok, I'll check this today and I'll test it with browserify.

Thanks @hoangnguyencong !

jgermade commented 9 years ago

Hi @hoangnguyencong, now it works (at least is working for me)

In order to enable jqlite as $ global object, I've used this code:

global.$ = require('jqlite');

thanks a lot for the feedback!!

hoangnguyencong commented 9 years ago

It worked. Many thanks @jgermade.