You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m hoping to create a workflow where I can easily port Webflow code to Gatsby while minimizing recurring manual changes when using AppFairy.
The intermediary step was to get my site working using a create react app project. Using AppFairy, I’m able to get most of the website working with create react app.
When I run gatsby develop and gatsby build, the CSS styling seems to work, but everything is still off. I think it has to do with how some of the scripts are added via AppFairy, particularly webflow.js.
Before I get into the AppFairy questions - I’m reading that combing jQuery with React breaks a lot of patterns. Frankly, I don’t care so long as it works, but could this prevent me from porting Webflow to Gatsby?
Here is a snippet from the AppFairy generated IndexView.js for my project:
componentDidMount(){constscripts=[fetch("https://d3e54v103j8qbb.cloudfront.net/js/jquery-3.4.1.min.220afd743d.js").then(body=>body.text()),fetch("js/webflow.js").then(body=>body.text()),]scripts.concat(Promise.resolve()).reduce((loaded,loading)=>{returnloaded.then((script)=>{newFunction(` with (this) { eval(arguments[0]) } `).call(window,script)returnloading})})}
I moved const scripts into comonentDidMount because global is not exposed during the gatsby build process (but this does not cause problems during gatsby develop).
This is my understanding of the code - after the script has fully loaded, execute the script in the window context
Is this akin to dependency injection? Like script injection, but for that specific react component?
What happens to this script during react-scripts start and react-scripts build? I can’t find the <script> related to jquery or webflow.js. Is it “integrated” into the React component?
Can I treat webflow.js like any other script i.e. can I create an npm package from that file and fetch it via unpkg?
Lastly, what is going on with the following from scripts.index.js:
I’m hoping to create a workflow where I can easily port Webflow code to Gatsby while minimizing recurring manual changes when using AppFairy.
The intermediary step was to get my site working using a
create react app
project. Using AppFairy, I’m able to get most of the website working withcreate react app
.When I run
gatsby develop
andgatsby build
, the CSS styling seems to work, but everything is still off. I think it has to do with how some of the scripts are added via AppFairy, particularlywebflow.js
.Before I get into the AppFairy questions - I’m reading that combing jQuery with React breaks a lot of patterns. Frankly, I don’t care so long as it works, but could this prevent me from porting Webflow to Gatsby?
Here is a snippet from the AppFairy generated
IndexView.js
for my project:I moved
const scripts
intocomonentDidMount
because global is not exposed during thegatsby build
process (but this does not cause problems duringgatsby develop
).This is my understanding of the code - after the script has fully loaded, execute the script in the
window
contextreact-scripts start
andreact-scripts build
? I can’t find the <script> related to jquery or webflow.js. Is it “integrated” into the React component?webflow.js
like any other script i.e. can I create an npm package from that file and fetch it via unpkg?Lastly, what is going on with the following from
scripts.index.js
:The text was updated successfully, but these errors were encountered: