[PLUGIN] Import (Previously "CSS Import")

Post your completed addons to share with the community

Post » Fri Jan 18, 2013 8:47 pm

Import
Image

About
Import, previously known as the CSS Import plugin (download still available at bottom of post), has been updated and renamed - it now supports JS as well as CSS (open to suggestions for other filetypes you'd normally add to the exported HTML, if any)

The Import plugin allows you to import files you've added to your project into the DOM at runtime (even with NW.js!) instead of having to edit the index.html each time you export.
Primarily it's just meant for testing things like CSS or JS modules without the need to export, but depending on your project you may be able to use it in your releases as well.
A tiny drawback for instance with importing at runtime is that it's not immediately loaded, so you might see styled elements switch from original look to styled for a few ms. if you load directly into a layout. This can be hidden with a loading layer, layout or setting initial visibility of styled elements to hidden, then unhiding them at start with events.

Usage
If you only need to import one file you can use the Auto-import field under the plugin properties.

Image

There's no benefit of Auto-import vs events and you can combine both methods as well if you'd like. For example, import module.js via Auto-import and style.css at start with the Import file event. There's built-in protection from accidentally importing the same file several times but it may not be bullet proof so try to avoid it if possible :]

Image

Import v1.1 Download - June 9th 2017
Plugin: mck_import.zip

CSS Import v1.0 Download - January 18th 2013
Plugin: css_import.zip
Example: css_import.capx
Screenshot: http://i.imgur.com/ZWVFy.png

Credits/Disclaimer
The plugin was basically Frankenstein'd from Pode's HTML Div plugin (because it contained CSS stuff) + code scavenged from the web. So credits to Pode and this site specifically for making this possible.

I have no real coding skills, this was mainly just for personal use and don't think I'd be able to make a plugin from scratch. So this means I can't guarantee it working flawlessly. I've only tested it in Chrome on Windows 7 and 10, so if it breaks down and blows up your computer, I warned you!

Enjoy!
Last edited by McKack on Fri Jun 09, 2017 5:03 am, edited 3 times in total.
B
94
S
35
G
8
Posts: 32
Reputation: 9,350

Post » Fri Jan 18, 2013 9:46 pm

Good one!

it helps for the entire HTML file
B
97
S
35
G
29
Posts: 3,139
Reputation: 28,371

Post » Tue Apr 23, 2013 2:44 pm

Sorry, we are unable to retrieve this document. - said Google. Please repair links.
B
8
S
2
Posts: 56
Reputation: 1,021

Post » Sat Apr 27, 2013 1:38 am

Sorry! Links should work now.
B
94
S
35
G
8
Posts: 32
Reputation: 9,350

Post » Fri May 10, 2013 7:11 am

@McKack
hi. can this plugin support css files with images?SirG2013-05-10 07:12:21
ImageImage
B
79
S
25
G
7
Posts: 191
Reputation: 10,295

Post » Tue May 14, 2013 8:56 pm

I don't see any reason it shouldn't work. Did you try without succeeding?
B
94
S
35
G
8
Posts: 32
Reputation: 9,350

Post » Sat May 25, 2013 1:36 pm

Link from download page is broken.
B
8
S
1
Posts: 31
Reputation: 598

Post » Sat May 25, 2013 4:14 pm

B
25
S
11
G
5
Posts: 140
Reputation: 5,029

Post » Tue May 28, 2013 11:58 am

Links still working here.
B
94
S
35
G
8
Posts: 32
Reputation: 9,350

Post » Wed Apr 16, 2014 10:39 am

@McKack I try putting a background gradient but cannot seem to make it work. I am talking about layout background not a button or text.Can you give please some pointers?
Thanks
B
79
S
21
G
23
Posts: 513
Reputation: 18,648

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest