Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preline JS Bundle not working #49

Closed
ankurdhamija83 opened this issue Feb 16, 2023 · 18 comments
Closed

Preline JS Bundle not working #49

ankurdhamija83 opened this issue Feb 16, 2023 · 18 comments

Comments

@ankurdhamija83
Copy link

Hi All,

Thanks for creating this amazing library.
I am facing issue with the js bundle.

The components are loading correctly on the webpage but the js functionality is not working. I followed the instructions to load the preline js file on the page, however, there seems to be some issue. Dropdown, banners and other components which require js functionality are not working.

Kindly help.

@koossaayy
Copy link

Can you add some code for reference ?

@ankurdhamija83
Copy link
Author

{{> title}} {{> tailwind-css}} {{!-- --}} {{{ body }}} <script src='/js/preline.js'></script> <script src='/js/test.js'></script>

@ankurdhamija83
Copy link
Author

This is a handlebars layout code. Including the preline js file at the end of the body tag.

@koossaayy
Copy link

Using this, can you confirm there is an error in the console in the browser ?

{{> title}} {{> tailwind-css}} {{!-- --}} {{{ body }}} <script src='/js/preline.js'></script> <script src='/js/test.js'></script>

@ankurdhamija83
Copy link
Author

ankurdhamija83 commented Feb 20, 2023 via email

@koossaayy
Copy link

Because if the all of the JS functionalities are not working, that means the JS file is not loaded.
However, according to the documentation, if you installed the library via npm,
the preline.js file should be loaded from node_modules, as follows

<script src="./node_modules/preline/dist/preline.js"></script>

@ankurdhamija83
Copy link
Author

ankurdhamija83 commented Feb 20, 2023 via email

@azupardo
Copy link

@ankurdhamija83 You can load the js file like @koossaayy said. Please note that it depends where your preline js location.

@ankurdhamija83
Copy link
Author

ankurdhamija83 commented Feb 21, 2023 via email

@ankurdhamija83
Copy link
Author

ankurdhamija83 commented Feb 21, 2023 via email

@koossaayy
Copy link

Hello Jessie,

Thanks for your reply.
Sorry, but I am unable to load the file correctly from node_modules
directory in my application views.

I copied the preline.js file from node_modules/dist/preline.js and copied
it to public/js/preline.js. In the handlebars view, it is loaded as <script src='/js/preline.js'></script>
On the frontend, I don't get any error message for preline.js but the
script doesn't work.

Kindly suggest, how should I load the file directly from node_modules and
serve it on the frontend.

Thank you

On Tue, Feb 21, 2023 at 8:54 PM Jessie A. Azupardo @.***>
wrote:

@ankurdhamija83 https://github.com/ankurdhamija83 You can load the js
file like @koossaayy https://github.com/koossaayy said. Please note
that it depends where your preline js location.


Reply to this email directly, view it on GitHub
#49 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AFOYL5PPSFIXWTDGHU3JRPDWYTMZPANCNFSM6AAAAAAU6GUSFM
.
You are receiving this because you were mentioned.Message ID:
@.***>

The integration process you're doing is wrong.
The file preline.js is set to call other components, i.e : Modal, Dropdown, etc...
So copying just the file, won't work. That's why you need to install it via NPM, and require the plugin in the config file of Tailwind.

@ankurdhamija83
Copy link
Author

ankurdhamija83 commented Feb 21, 2023 via email

@azupardo
Copy link

Hi,

I think you are getting 404 in your preline.js.

Move this "preline" folder inside your public folder which you can load it in your project.

Example :

https://prnt.sc/5UvmeJA-GvN_

https://prnt.sc/_F26QZMlDeU9

@zhandos38
Copy link

I have solved this problem by removing important param in talwind.config.js. Hope it will help someone.

@azupardo
Copy link

I have solved this problem by removing important param in talwind.config.js. Hope it will help someone.

What did you removed?

@o2sevruk
Copy link

o2sevruk commented Mar 22, 2023

@ankurdhamija83 Hi,
which framework or library do you use (React, Vue)?
As I see you're import the script in the head tag, but you should import it before closing body tag.

@zhandos38
Copy link

@azupardo
{
important: true,
}

@jahaganiev
Copy link
Member

Hey folks! Thanks everyone for the input - I am converting this issue into Discussions.

@htmlstreamofficial htmlstreamofficial locked and limited conversation to collaborators Apr 23, 2023
@jahaganiev jahaganiev converted this issue into discussion #70 Apr 23, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants