Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Add javascript file #1069

Closed
MarineLB opened this issue Sep 6, 2017 · 4 comments
Closed

Add javascript file #1069

MarineLB opened this issue Sep 6, 2017 · 4 comments

Comments

@MarineLB
Copy link

MarineLB commented Sep 6, 2017

Hello ! :)
I'm trying to add the classie.js file in my FoundationPress install.

I first tried to just copy the file inside of /src/assets/js/app.js but I had a "Uncaught ReferenceError: classie is not defined at HTMLDivElement.initSearchFn".
So I tried to add it as a file in /src/assets/js/lib/ and import like import './lib/classie'; but I still get the same error.
I tried a codepen with the same HTML/CSS/JS and I don't get the error so I assume something is wrong with the way I load the file.

What's the right way to add other scripts in the new Foundation setup ?

@olefredrik
Copy link
Owner

Hi.

As you didn't use the issues template, I don't know what version you're on. So I'm assuming you are using the latest version of FoundationPress.

I guess there are many ways you can add scripts. But as a reference, you can see how I add the script that is used for the demosite here

https://github.com/olefredrik/FoundationPress/blob/master/src/assets/js/app.js#L11

Should be pretty straight forward.

@MarineLB
Copy link
Author

MarineLB commented Sep 6, 2017

Yes I'm using the latest version ! So the right way to add is :

  1. Add the file in /lib directory
  2. Add import './lib/nameoffile';

Am I understanding this correctly ?

@olefredrik
Copy link
Owner

Yup. (And of course make sure that you place the file.js in your /lib folder).

@MarineLB
Copy link
Author

MarineLB commented Sep 6, 2017

Alright thank you ! Then I was actually doing it correctly !

@MarineLB MarineLB closed this as completed Sep 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants