External CSS & JavaScript Files

Hi all,
I’ve been looking at Xway this week, and I was wondering if it is possible to use external CSS and JavaScript files? I know I can import a file, but that will be written into the document. What I’m after is a way to include the file as an external resource. Is this currently possible, or on the “to do” list.

Can CSS & JavaScript created by Xway also be bundled into an external file?

I had been looking at using a component to handle this, but I can’t seem to find a way to refresh it when I change a file in the component bundle.

All the best,
Paul.

Hi Paul,

It’s good to hear from you again!

Including a file as an external resource is definitely on our to-do (fairly soon) list. Components can include their own CSS and JavaScript files, but it’s probably a bit hacky to use them as a workaround, since they’re designed as page boxes. If a file in the component changes, Xway should enable the Update button in the Component section of the Box Inspector. If that’s not happening, send us a bug report with some reproducible steps.

Xway doesn’t currently have an option to output its own CSS in an external file (except for navigation menus, which always output CSS and JavaScript to external files). It’s on our to-do list, but we haven’t prioritised it. Freeway had an option to do this, and it caused a number of bugs that didn’t happen when the option was turned off - so when we do implement it, we don’t want that to happen! We also want to preserve the current hierarchy of CSS styles: anything that people add in a CSS Markup section should override anything that is added by a component or by a navigation menu, or by Xway itself (unless the component has prevented that by using !important). That allows users to tweak the way that galleries are displayed, without having to edit a CSS file that is probably going to be overwritten next time a site is published.

I think that doesn’t happen for things in subdirectories, like the resources folder. I haven’t checked the code to see what’s actually happening but the behaviour I observed was that Xway needed to see the modified date on the package (a folder) change.

Therefore making a change to one of the files in the root, such as markup.html, would cause the Update button to become available while making a change only inside the resources folder would not.

What this does mean though is that you can trigger the update becoming available by making a change to info or one of the other files that doesn’t affect output.

Hi Jeremy & Simon :grinning:

I’ve been making changes to the markup.html file, and the update button doesn’t highlight.

I tried making a change to the markup.html file in a component from Exhibeo too. Same problem.

I’ll send a bug report.

All the best,
Paul.

That’s odd. It does for me.

Xway enables that button if the modification date has changed. Components are packages, so the modification date behaviour is similar to the modification date behaviour of folders, and it’s possible that the date doesn’t change if you modify a file that isn’t in the root directory (as Simon suggested). But markup.html is in the root directory.

The Update button should be enabled instantly if you switch out of Xway and back, but it could take longer to be enabled if you modify a component without switching out of Xway (I’m not sure how you could do that, but a background process might).

Hi,
Not here. I’ve tried editing all the files in the root directory of the component, and I don’t get any update button highlight. I have to use the Replace button to force a reload.

All the best,
Paul.

Is there anything odd about the drive that contains the components. Is it a local Mac (APFS or HFS+) drive or is it some kind of network drive?