Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#49 2018-04-12 20:21:27

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Testers needed: flat development (4.7+ only)

My high-level plan would be (once the list is shortened):

  • all unlisted extensions default to .css on both export and output;
  • the listed ones are exported with their own extension, without .css;
  • the old css.php?n=test.js links generated via <txp:css name="test.js" /> still serve text/css mimetype, for backwards compatibility;
  • to output test.js as application/javascript, link it with some e parameter: css.php?n=test&e=js. Note that this will look for test.js style in the db;
  • generate the URL above with <txp:css name="test" type="js" /> or simply <txp:css name="test.js" type />.

How’s that?

Offline

#50 2018-04-12 20:45:40

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Testers needed: flat development (4.7+ only)

etc wrote #310959:

How’s that?

Spiffing. My only reservation is that using the tag <txp:css> to output a URL to something non-CSS is a little wonky. What would this output:

<txp:css name="test" type="js" format="link" media="print" />

Do we ignore the other attributes for non-CSS files?

Also, when using format="link" we assume that the output is going to be a <link> served via css.php? If you specify format="url" you get a raw URL spat back. What if you want your .js to output as a <script> tag? Seems reasonable. What about SVG (assuming you accept the scripting risks)? Should that render <img src="test.svg" /> if you use format="link"?

And what if you want to render the contents verbatim, not as a URL but as the actual content? format="raw" seems useful. Could we accommodate that?

Using the old tag for all this functionality seems fraught with gotchas. Perhaps a new <txp:asset> tag is cleaner to output anything from the Assets — including CSS — as either a URL processed via css.php as you outlined above, or raw output. Either way, people will have to construct their own markup around it. And we then leave <txp:css> to only process CSS (.css) assets.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#51 2018-04-12 21:01:37

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Testers needed: flat development (4.7+ only)

I wouldn’t try to accommodate all possible formats with all possible attributes. Yes, a new tag seems reasonable, feature set to discuss. Not sure svg is more risky than js or xml, but let’s drop it, who will ever want to edit it? Or not?

Two hours of coding they say…

Offline

#52 2018-04-12 21:08:51

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Testers needed: flat development (4.7+ only)

Okay, I have submitted the first part. To test:

  • create (via Styles) a style called test.js with alert('Hello, bloatware!') inside;
  • include <script src="path_to_site/css.php?n=test&e=js"></script> in some article.

Offline

#53 2018-04-12 21:22:10

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Testers needed: flat development (4.7+ only)

Cool! And it’s parsable via the Easter egg ;-)

BTW, the enforced .css extension can be found in Skin/CommonBase.php and Skin/AssetBase.php. Search for extension and you’ll see the paths being constructed by hand in a few places. The default for all asset types is txp but the Skin/Css.php class overrides the static $extension to css so assets of that type get built like that.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#54 2018-04-12 21:29:17

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,596
Website

Re: Testers needed: flat development (4.7+ only)

Bloke wrote #310965:

Cool!

Cool +1!

And it’s parsable via the Easter egg ;-)

What is that?

etc wrote #310963:

svg … but let’s drop it, who will ever want to edit it? Or not?

Actually, that is something one sometimes wants to edit, if only to add id, classes or href details to it. One case I’ve had is a map with linked rollover regions.


TXP Builders – finely-crafted code, design and txp

Offline

#55 2018-04-12 21:34:03

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Testers needed: flat development (4.7+ only)

jakob wrote #310966:

What is [the Easter egg]?

If I told you I’d have to kill you.

set a hidden pref called parse_css to 1 and you can use <txp:> tags in your asset content. I know where you live.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#56 2018-04-12 21:36:32

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Testers needed: flat development (4.7+ only)

Thank you gentlemen, will continue tomorrow. And probably change e for x (sounds more like extension).

Lost my Easter egg today, dropping a wrong db when trying to install 4.5.7 :-(

Offline

#57 2018-04-12 22:01:53

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,596
Website

Re: Testers needed: flat development (4.7+ only)


TXP Builders – finely-crafted code, design and txp

Offline

#58 2018-04-12 22:10:34

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: Testers needed: flat development (4.7+ only)

Love it!

But… The Styles panel needs to be renamed ;)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#59 2018-04-12 22:59:52

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,079
Website

Re: Testers needed: flat development (4.7+ only)

Pat64 wrote #310970:

Love it!

Me interested too (not immediately for JS/CSS though), but SVG / JSON / …

But… The Styles panel needs to be renamed ;)

Resources ?

Bloke wrote #310967:

If I told you I’d have to kill you.

… copy/paste something into my Notes.app…

Kill me now, you’ll regret it.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#60 2018-04-13 05:46:02

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: Testers needed: flat development (4.7+ only)

Bloke wrote #310962:

Spiffing. My only reservation is that using the tag <txp:css> to output a URL to something non-CSS is a little wonky.

what about <txp:asset type="js" name="myjs" /> and for css <txp:asset type="css" name="mystyle" media="screen" />?

On the upgrade installer all styles which are already in existence could be renamed with a .css extension

Do we ignore the other attributes for non-CSS files?

Also, when using format="link" we assume that the output is going to be a <link> served via css.php? If you specify format="url" you get a raw URL spat back. What if you want your .js to output as a <script> tag? Seems reasonable. What about SVG (assuming you accept the scripting risks)? Should that render <img src="test.svg" /> if you use format="link"?

And what if you want to render the contents verbatim, not as a URL but as the actual content? format="raw" seems useful. Could we accommodate that?

Using the old tag for all this functionality seems fraught with gotchas. Perhaps a new <txp:asset> tag is cleaner to output anything from the Assets — including CSS — as either a URL processed via css.php as you outlined above, or raw output. Either way, people will have to construct their own markup around it. And we then leave <txp:css> to only process CSS (.css) assets.

if svgs are included I agree that it is getting more complicated. As such it’s not a big think to contract our own html tags for the assets.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB