Importing CSS & ASSets into a widget

In order to have a clear understanding of the dev environment I spent some time last week importing various CSS libraries.

Apparently one can, with the dev env (really, with ParcelJS), import any and many CSS libraries along with a local CSS file.

I can use two different frameworks (for some reason) and they both work.

In this image, the left column is styled by Bootstrap. The right is styled by Materialize.

Cool

NOTE: Remember that CSS files are loaded from top to bottom in the html file, and any styles that are in the later files will overwrite styles of the same name in the earlier files.

As we are learning, all of this CSS will be inlined into one string when we deploy to FM.

But then . . .

I started reading the documentation more closely and found something interesting.

I can import assets into my widget as well, and they work just perfectly in the deployed widget.

That’s incredible. What do you notice?

The assets are stored in my project, but when deployed, they are part of the inlined string.

In the examples above I’m using both CSS and JS to set the image in to the WV. The rainbow image, repeated across the div is set via the CSS, and the Integrating Magic Logo is set into the div as an image.

Finally (did you see the bottom right?) I inserted a video into the widget. And yes, it is inlined.

So static assets that are part of the widget can be, thanks to the dev environment (ParcelJS) can be placed into a WV with no issues.

Yes, the images have to be stored with the project. But that’s no concern; image files have to be stored somewhere. Might as well be the project itself.

ParcelJS, running the Dev Environment, is a boon to us FileMaker developers in all manner of ways.


EDIT: I forgot to show the ways the assets are added:
CSS:

And in the JS