twig.js icon indicating copy to clipboard operation
twig.js copied to clipboard

Switch to Module Pattern (replace Twig global)

Open PolyPik opened this issue 5 years ago • 3 comments

@RobLoach

Each of the files simply serve to build up the Twig god object.

What was the rationale behind this design? God objects are considered to be an anti-pattern.

PolyPik avatar May 08 '19 19:05 PolyPik

God is an anti-pattern :smiling_imp:

Likely legacy, for allowing acting on a global through the web browser. Packages like Browserify and webpack can fix that pattern for us. Would be good to switch to ES6 modules across all the files.

RobLoach avatar May 08 '19 19:05 RobLoach

There were mentions of a 2.0.0 release in other topics and PRs. The 2.0.0 release should breakup the global object into modules as part of the changes, would you agree?

PolyPik avatar May 16 '19 18:05 PolyPik

We can wait on a 2.x for this, yes.

RobLoach avatar May 16 '19 19:05 RobLoach