Skip to content

9: Configuration

Sebastian Schendel edited this page Jan 4, 2021 · 3 revisions

Twack allows you to change the location of the directories, where it looks for component- and service-classes. Change it to any location you like - they don't have to stay in your site/templates/ folder, if you want to have them somewhere else.

In the input "TwackControl", you can give an alternative TwackControl-class, which handles the way Twack looks for components. I don't think, that it is necessary in most cases. But if you need to manipulate it, you should take a look at the core TwackControl-class. Create your own class which extends the core-class, and paste the location to the module's configuration.

Additionally, it is possible to give Twack the path to a manifest.json-file, which holds the real locations for your asset-files. I normally use frontend-workflows, that generate optimized and minified asset-files for me. Typically I let the workflow generate distribution-files, that have a unique hash in their filenames, what prevents the browser to load outdated files. But I surely don't want to paste these hashed-filenames in my code every time I do a rebuild. Twack can use the path to my manifest.json-file, that is generated at every asset-rebuild. Look at my this webpack.json, that I does exactly this. To include my main.jsfile from site/templates/assets/js/main-8f56bd9a.min.js, I can use the following line in the view:

<script src="<?= wire('config')->urls->templates; ?>assets/js/<?= Twack::getManifestFilename('main.js'); ?>"></script>

⬅️ Back to 8: Ajax-Output