-
Notifications
You must be signed in to change notification settings - Fork 0
9: Configuration
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.js
file 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>
Twack
Reusable components for your ProcessWire-templates!
ProcessWire-Module: | https://modules.processwire.com/modules/twack/ |
Support-Forum: | https://processwire.com/talk/topic/23549-twack/ |
Repository: | https://github.com/Sebiworld/Twack |
Wiki: | https://github.com/Sebiworld/Twack/wiki/ |