flexx icon indicating copy to clipboard operation
flexx copied to clipboard

Allow .map assets

Open thilomichael opened this issue 6 years ago • 3 comments

Hi!

I'm very new to flexx so maybe I'm completely on the wrong track ;) I was trying to use interact.js with flexx by loading it with the associate_asset function.

The library includes a source mapping URL which flexx refuses to load (due to it having .map as a file ending):

ValueError: Asset names always end in .js or .css

Maybe it is useful to include .map to the allowed file extensions (flexx/app/_assetstore.py:346):

if not name.lower().endswith(('.js', '.css', '.map')):
            raise ValueError('Asset names always end in .js, .css or .map')

thilomichael avatar Jun 01 '18 09:06 thilomichael

I agree! Would you be up for creating a PR for this?

almarklein avatar Jun 01 '18 10:06 almarklein

Sorry for the late reply! I will look into creating a PR but can't promise much.

Is there some documentation on how the asset store is working? Just adding '.map' seems like a dirty fix because it seems there are different to_html functionalities for the different asset types.

Is there some kind of IRC channel where I can ask some questions?

thilomichael avatar Jun 08 '18 11:06 thilomichael

Is there some documentation on how the asset store is working?

Other than the comments in the code, no. Sorry.

Just adding '.map' seems like a dirty fix because it seems there are different to_html functionalities for the different asset types.

You're right. js and css can be embedded in HTML, and thus an app can be exported as a single HTML document. This wont work for .map files. So we need to think about this more carefully. I think we can still make it work; in to_html() we can probably just ignore .map assets. I think that that is the only place where we need to add an extra elif clause

Is there some kind of IRC channel where I can ask some questions?

There is a gitter channel: https://gitter.im/zoofIO/flexx

almarklein avatar Jun 14 '18 08:06 almarklein