Custom Code Only Page

I have a set of code (JS, CSS, and HTML) that I want to integrate into my webflow site. The problem is, I’m running into the character limit and even importing the code as .txt under the resource doesn’t behave the way I expect it to (either opening the .html locally or hosting it elsewhere). I had a few questions:

  1. Is it possible to have an entire page hosted only running on custom code (no Webflow stuff)?
  2. If not, can I upload .css as .txt and load them similar to how .js can be loaded (via renaming the .js as a .txt and loading it as type=“text/css”?)
  3. If not, are there any links or tips on populating fields from CMS records automatically? Can I load CMS records from a database, CSV, or other type of file?

If you search the forum, you’ll see that one technique is to save your javascript or css file as a .txt file and then upload it to assets. You can then reference it and declare the mime type in the reference to override the server’s text/plain mimetype.

For a CSS file that would be;

<link rel="stylesheet" type="text/css" href="mycssfile.txt">

Should work fine, but it’s a pain in the butt because you can never edit it, and any changes mean uploading a new file and changing your URL references.

Instead, you’d be better off learning how to host those files elsewhere, like Github → jsDelivr, or on Netlify. Even Google drive or Dropbox can do well for some types.

Some notes here.

1 Like

Thanks Michael,
Do you have a reference for declaring the mime type and overriding it?

Hi Paul, not sure what you’re asking.

Googling mime types comes up with the link below, and the type you requested (CSS) is in my example above. I’ve not seen this Webflow hack used for CSS before, so test it out. JS files are more commonly stored with this approach.

Again, much better to punt on this hack, and host the files properly somewhere else.

https://www.iana.org/assignments/media-types/media-types.xhtml#text