File Endings for TypoScript files and TSconfig files


(Benni Mack) #1

Discussion Topic

The TYPO3 Core currently allows any file extension as ending for loading (basically simple text files) TypoScript configuration files, or TSconfig files (although this is similar syntax, but not the same configuration language).

We want to have best practices, so I’d go for defining / deciding on a default / best practice file ending, simply using “.t3s” for TypoScript configuration files (no difference between constants and setup) and using “.tsconfig” for TSconfig.

I already did a poll on Twitter some time ago on that: https://twitter.com/bennimack/status/784837984180928512

Both Benji and me are rooting for “.t3s” for TypoScript and “tsconfig” for TSconfig (user/page does not matter).

Impact

  • People will have to adapt their personal workflows, certain definitions are already based on “.ts” or “.txt”, and we’d have some migrations in place for them.

Possible Migrations

  • Deprecations for other file endings (but then do that in v9)

Pro

  • Showing newcomers what’s a best practice, and how to “do it right”.

Con

  • Personal hard feelings (as I noticed on twitter already ;)).

Organizational

Topic Initiator: Benni Mack
Topic Mentor: Benjamin Kott


File Endings for TypoScript and TSconfig files - Results
(Susi Moog) #2

The only thing I see as confusing with .t3s would be the 3 - because where does that come from? But yes, in general, I’m all for changing away from ts as fast as possible (and not to txt).


(Maddy2101) #3

fine with me.

well yeah, 20 chars to post. Still fine with me.


(Georg Ringer) #4

I still would like to have different file endings for constants and setup. Reasons:

  • Those files do different things and it makes it easier to know without looking what it does
  • It makes it easier to have a site package and include for constants all constant files and for setup all setup files

(Markus Klein) #5

While we use .ts currently, I would really opt to migrate that away, since this heavily collides with TypeScript, which is a no-go nowadays.
.txt is completely out of discussion!

I don’t mind about a separation of template and tsconfig. Those are dedicated folders anyway and syntactically there is NO difference between them. Most of the endings in use currently reflect the syntax that is used inside a file and not what there are meant to be used for. (.html for HTML, .js for JavaScript, .json for JSON and so on)

My vote would therefore be for this kind of guideline:

  • TypoScript:
    • Folder: ext:myext/Configuration/TypoScript/...
    • Ending: 10.somefile.constants.t3s and 10.somefile.setup.t3s
  • Page TSconfig:
    • Folder: ext:myext/Configuration/TsConfig/Page/...
    • Ending: 10.something.t3s
  • User TSconfig:
    • Folder: ext:myext/Configuration/TsConfig/User/...
    • Ending: 10.something.t3s

(Mathias Schreiber) #6

@liayn you are of course right about the syntax.
The syntax looks similar for TypoScript and TSConfig, but is it?
I don’t know where TypoScript is able to work with the := syntax, neither am I sure if mod_list < rte would work in TSConfig.

Please don’t take this cynical or alike, I honestly don’t know :smiley:


(Markus Klein) #7

It works exactly the same! The same parser is used :wink:

There is only one specific thing to TypoScript that ONLY works if a cObject is expected at a certain place and that is the =< reference operator.

The whole thing in action: https://bitbucket.org/reelworx/rx-typo3-sitesetup/src/4ff58089b3dc0d12cede3782e2998fa70ca44c36/Configuration/TsConfig/Page/1.rte.ts?at=master&fileviewer=file-view-default


(Mathias Schreiber) #8

ok.
So basically we only need to decide whether we want to live with people confusing TypoScript capabilities with TSConfig syntax.
This is the only reason to keep both file-suffixes separated.


(Oliver Hader) #9

For a consistent approach in using the file extension to tell, how the contents are interpreted and used, we would end up with the following:

  • .settings.typoscript for front-end TypoScript
  • .constants.typoscript for constants used in front-end TypoScript
  • .settings.user.tsconfig for User TSconfig
  • .constants.user.tsconfig for contants in User TSconfig
  • .settings.page.tsconfig for Page TSconfig
  • .constants.page.tsconfig for contants in Page TSconfig

The general scope (TypoScript, User TSconfig, Page TSconfig) is currently reflected via folder names already.
That’s why I’d opt for just one file extension for all - .typoscript, just my two cents.


(Markus Klein) #10

Agreed here, and I don’t mind if it’s .typoscript or .t3s or anything “potentially unused”.


(Morton Jonuschat) #11

I would prefer .typoscript, it makes it more obvious what is in the file. While I get the .t3s it isn’t really obvious to the unexperienced user.


(Alexander Opitz) #12

That’s exactly how we do it at work on newer projects.


(Christian Kuhn) #13

I’d prefer .typoscript and .tsconfig, too.


(Philipp Gampe) #14

We have IDEs and completion, and most important modern filesystems with more than 8.3 character support, therefore I would go with .typoscript.

In order to distinguish FE TS Setup, FE TS Constants, Page TS and User TS, I suggest to move to the following best practices that allows allow bulk inclusion:
*.setup.typoscript
*.constants.typoscript
*.user.typoscript
*.page.typoscript

The middle part can be omitted if dedicated folders are used (e.g page and user), however for setup and constants it makes a lot of sense to keep both files in the same folder.

The proposal is a bit lengthy, but we have many lengthy file conventions already it there we not many complains so far, because the better readability makes up for length.


(Markus Klein) #15

Bulk inclusion is done solely on directory basis in our workflow.

however for setup and constants it makes a lot of sense to keep both files in the same folder.

I totally disagree on this.


(Mathias Schreiber) #16

I know it’s the same parser, still I’d like to keep the separation between the two, just for “don’t confuse things” reasons.
I won’t anything, of course :smiley:


(Philipp Gampe) #17

To summarize, we now have the following proposals:

  • .t3s (only)
  • .t3s + .tsconfig
  • .typoscript (only)
  • .typoscript + .tsconfig

Can we move this part to a vote?

There seems to be an agreement to separate the different types by folders, the names are not so clear yet.

I would actually like to move away from calling the frontend render configuration just TypoScript, because it is confusing for newcommers. I would prefer something like

  • Rendering
  • Page
  • User

all in Configuration/TypoScript/. The problem is that the frontend TS also includes lots of stuff that is not directly related to rendering (e.g. extbase class mapping, backend stuff, etc).
On the other hand, we are defining a default, not a strict configuration. People can just deviate from the suggested setup if they wish.


(Susi Moog) closed #18

This topic was automatically closed after 17 days. New replies are no longer allowed.


(Josef Glatz) #19

The time is over, but what about

  • .setupts (TypoScript Setup)
  • .constantsts (TypoScript Contants)
  • .tsc (TypoScriptConfig)

With that you can

  • differate between types just by checking the file extensions
  • AND it’s possible to place constants and setup in recursive included TYPOSCRIPT_INCLUDE folders.

(Markus Klein) #20

Keep in mind that pageTSconfig (and therefore also userTSconfig) influences FE TypoScript!
(you can define constant for TS via TSconfig)
So TSconfig is also a hybrid for BE and FE configuration.

I agree that we should move away from TypoScript for rendering to something “TSrendering” or so, because TypoScript is name of the syntax!