<p>Craft doesn't output any code unless you write it, so you have complete freedom to use any standard front end build process and include the built files in your templates. There are a few plugins that help with this depending on build process though, such as:</p>

<ul>
<li><a href="https://plugins.craftcms.com/mix" rel="nofollow noreferrer">https://plugins.craftcms.com/mix</a></li>
<li><a href="https://plugins.craftcms.com/twigpack" rel="nofollow noreferrer">https://plugins.craftcms.com/twigpack</a></li>
<li><a href="https://plugins.craftcms.com/minify" rel="nofollow noreferrer">https://plugins.craftcms.com/minify</a></li>
<li><a href="https://plugins.craftcms.com/assetrev" rel="nofollow noreferrer">https://plugins.craftcms.com/assetrev</a></li>
</ul>

CC BY-SA 4.0
2019-06-12T08:30:38.730Z
Thanks. I don't quite get it yet. I read this document: https://docs.craftcms.com/v3/extend/asset-bundles.html 

Is it possible to use this technique in a template (the doc is located under extensibility and plugins - not sure if it applies to templating). 

Or are you proposing that I should use gulp/grunt to minify, combine and compress the files prior to adding them to the template?
nitech
CC BY-SA 4.0
2019-06-12T11:26:25.657Z
Yeah you can ignore the asset bundles page - that's about plugins. When you're dealing with the front end of the website, you could do you minifying with something like grunt/gulp/mix, then just include the minified CSS file in your template like a normal HTML page. In the case of using the Mix plugin, that would be <link rel="stylesheet" href="{{ mix('/css/app.css') }}">
darylknight
CC BY-SA 4.0
2019-06-12T11:27:44.340Z
Yeah, okay. I understand. Thanks :-)
nitech
CC BY-SA 4.0
2019-06-12T08:11:34.560Z
2019-06-12T08:11:34.560Z
darylknight
<p>I would like to combine all of my sites JS-files into one bundle - and perhaps also obfuscate it. </p>

<p>Same goes for CSS-files.</p>

<p>How would I do that in Craft CMS 3?</p>

<templating><assets>
How to do CSS/JS bundles/minifying in Craft 3
# How to do CSS/JS bundles/minifying in Craft 3

(Asked by: username_0 on 2019-06-12)

I would like to combine all of my sites JS-files into one bundle - and perhaps also obfuscate it.

Same goes for CSS-files.

How would I do that in Craft CMS 3?

**Tags:** templating, assets

---

## 1 answers

### Answer by username_1 on 2019-06-12. Score: 4 | Accepted answer

Craft doesn't output any code unless you write it, so you have complete freedom to use any standard front end build process and include the built files in your templates. There are a few plugins that help with this depending on build process though, such as:

* <https://plugins.craftcms.com/mix>
* <https://plugins.craftcms.com/twigpack>
* <https://plugins.craftcms.com/minify>
* <https://plugins.craftcms.com/assetrev>

> **Comments:**
> **username_0**: Thanks. I don't quite get it yet. I read this document: https://docs.craftcms.com/v3/extend/asset-bundles.html   Is it possible to use this technique in a template (the doc is located under extensibility and plugins - not sure if it applies to templating).   Or are you proposing that I should use gulp/grunt to minify, combine and compress the files prior to adding them to the template?  
> **username_1**: Yeah you can ignore the asset bundles page - that's about plugins. When you're dealing with the front end of the website, you could do you minifying with something like grunt/gulp/mix, then just include the minified CSS file in your template like a normal HTML page. In the case of using the Mix plugin, that would be <link rel="stylesheet" href="{{ mix('/css/app.css') }}">  
> **username_0**: Yeah, okay. I understand. Thanks :-)  

---

