Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2018-04-12 15:59:45

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

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

jakob wrote #310921:

The hook to trigger a sync would still be useful, though.

Agree, if it can be made secure enough.

colak wrote #310920:

I am testing this and loving it. I can see the styles, forms and pages being saved but we are yet to have a native way regarding js files. Will it be that hard to include if not on 4.7 on 4.7.1?

Basically, what will be needed is an extra pane under the presentation tab.

It’s not very orthodox, but in 4.7 you can create a form called, say, myScript.js, export it to the filesystem and serve from there. The server should then set the appropriate headers based on .js extension.

Anyway, I’m not sure we need a pane by mimetype. CSS and JS are the most used ones, but not unique. You might as well want to serve .txt or .html files one day.

Offline

#26 2018-04-12 16:08:42

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

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

I’m of the feeling that a JS panel is best left to a plugin, if you want that editable in core. I personally wouldn’t have included a CSS panel if I was designing Textpattern from scratch – but I can see why people use it.

Offline

#27 2018-04-12 16:15:12

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

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

philwareham wrote #310927:

I personally wouldn’t have included a CSS panel if I was designing Textpattern from scratch – but I can see why people use it.

Now that it’s there and synced with the filesystem, I would hack it for serving all type of content (CSS, JS, whatever) based, say, on name extension (CSS by default, JS for .js, etc). That’s quite easy to do.

Offline

#28 2018-04-12 16:16:06

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

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

etc wrote #310918:

I have tried, but some parameters of import/export requests (dunno which) seem to be fetched only from $_POST, not $_GET.

Shame. Will have to grep the Skin directory and see if we can find ps() and change to gps().

etc wrote #310919:

I would prefer something less automatic, like fetching directly from files in dev mode and syncing once everything is fine.

If that’s possible to factor in cleanly, then great. If not, I’m happy for it to be a plugin as a stop-gap for now until we can think it through for a future release. Probably won’t be 4.7.1, since that’s a patch release (unless we can convince ourselves that this feature “patches” the behaviour of 4.7.0!) In that regard, if we can get something working now prior to 4.7.0 final, we can always tweak it in 4.7.1 as it will then be classed as a patch. Remember we have the option of 4.7.0-rc after beta.3 if we need a week of pre-launch soak testing.

colak wrote #310920:

I am testing this and loving it.

Yay!

but we are yet to have a native way regarding js files. Will it be that hard to include

I’ve always resisted a dedicated JS pane in the admin side, even though it’s not much more tricky conceptually than CSS, for exactly the reason that etc states: it’s very niche. CSS is (arguably because there’s not much else) a fundamental part of how to style a website. JS isn’t, it’s optional.

I’d far rather offer an ability to handle files that contain human-readable text better and let you decide how to serve and interpret them. Then you could use the UI to write and store JSON, text files, javascript, less, SASS, SCSS, whatever, and have their counterparts represented in the theme. EDIT: and I see etc is on the same wavelength, just a minute faster than me at replying!

We’re not there yet. Maybe we never will. But I think restricting ourselves to the one mime type is going to make it harder to offer flexibility in future as we’ll end up marginalising other equally important or valid file formats.

Last edited by Bloke (2018-04-12 16:17:00)


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

#29 2018-04-12 16:22:24

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

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

Bloke wrote #310929:

Will have to grep the Skin directory and see if we can find ps() and change to gps().

Good luck, I’ve failed to find the right one.

Probably won’t be 4.7.1, since that’s a patch release (unless we can convince oursleves that this feature “patches” the behaviour of 4.7.0!)

Oh, why not. Themes are the main new feature of 4.7, so improving it based on users feedback suits my patch definition.

Offline

#30 2018-04-12 16:22:48

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

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

etc wrote #310928:

Now that it’s there and synced with the filesystem, I would hack it for serving all type of content (CSS, JS, whatever) based, say, on name extension (CSS by default, JS for .js, etc). That’s quite easy to do.

I’m totally with you here.

My original thought, waaaaay back, was a ‘type’ field but using extension is probably cleaner. It means that <txp:css /> needs to only consider the relevant file types. We could keep that tag around for compatibility and convenience, but introduce a new tag that could output “text file stuff” from this table with appropriate mime types; CSS would be one of the supported things we could output, even though it conceptually duplicates the <txp:css> tag, you might want to to output it raw or something, which is something we can’t do now.

What we’d call the panel in the Admin interface is questionable though…

Last edited by Bloke (2018-04-12 16:26:35)


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

#31 2018-04-12 16:23:27

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

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

etc wrote #310930:

Themes are the main new feature of 4.7, so improving it based on users feedback suits my patch definition.

There, see. You’ve talked me into it :-)


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

#32 2018-04-12 16:30:43

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

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

Actually (Easter egg), you can already enable CSS parsing and set headers with <txp:header />, but then serving flat files could be invalid. We could also introduce some mimetype attribute (guessed from the extension by default) to <txp:css /> (or its successor) for extra flexibility.

Offline

#33 2018-04-12 16:31:39

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

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

etc wrote #310926:

Agree, if it can be made secure enough.

It’s not very orthodox, but in 4.7 you can create a form called, say, myScript.js, export it to the filesystem and serve from there. The server should then set the appropriate headers based on .js extension.

I tried it. It adds a txp extension after the file name. ie myScript.js.txp

Anyway, I’m not sure we need a pane by mimetype. CSS and JS are the most used ones, but not unique. You might as well want to serve .txt or .html files one day.

I can fully understand what you are saying .json is becoming more and more common.

You did say something here which could actually make sense for future txp versions. That is if the css pane could change so as to support mime types.


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

Offline

#34 2018-04-12 16:34:37

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

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

etc wrote #310933:

Actually (Easter egg), you can already enable CSS parsing and set headers with <txp:header />, but then flat files could be invalid. We could also introduce some mimetype attribute (guessed from the extension by default) to <txp:css /> (or its successor) for extra flexibility.

Absolutely. Right now it formats a very specific type of URL to render a <link> tag or just squirts out the raw URL. Nothing to stop us using this new tag to output either the URL or the raw file contents passed through the auto-detected / overridden mimetype.


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

#35 2018-04-12 16:35:38

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

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

colak wrote #310934:

I tried it. It adds a txp extension after the file name. ie myScript.js.txp

Oops, sorry. Not sure why we need to append .txp extension, though.

Offline

#36 2018-04-12 16:36:04

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

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

colak wrote #310934:

if the css pane could change so as to support mime types.

Yes, that’s what we’re talking about now, and I think is the most logical way forward. Just can’t think of a decent name for the panel if it’s no longer just serving Styles.

Last edited by Bloke (2018-04-12 16:39:42)


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

Board footer

Powered by FluxBB