<p>To answer your question: I think you CAN, but it will not be easy.</p>

<p>Craft is built on top of the Yii framework. It lets you override things (settings, classes) in the <a href="https://docs.craftcms.com/v3/config/#application-config" rel="nofollow noreferrer"><code>config/app.php</code></a> file that gets installed by default. So, you should be able to change the view renderer to anything you want:</p>

<pre><code>&lt;?php

return [
    'components' =&gt; [
        'view' =&gt; [
            'class' =&gt; 'craft\web\View',
            'renderers' =&gt; [
                'slim' =&gt; [
                    'class' =&gt; 'path\to\your\slim\ViewRenderer',
                ],
            ],
        ],
    ],
];
</code></pre>

<p>Of course, this would require a Yii ViewRenderer based on Slim, which I don't think is  available (yet). You could build it yourself, based on the Twig ViewRenderer used by Craft.</p>

<p>The reason I would not do it, is that Craft has several Twig filters en functions that make your templating life easier. You'd have to create wrappers for those, to be able to use them. I don't think the added complexity of all this weighs up to the advantage of using Slim.</p>

CC BY-SA 4.0
2018-11-07T16:15:06.080Z
Thank you, seems like that I’ll continue working on the front-end in a separate project and copy the html to craft/twig templates.
aaandre
CC BY-SA 4.0
2018-11-07T12:45:19.473Z
2018-11-07T12:45:19.473Z
Paul
<p>Coming from ruby and rails, I’ve been using slim (<a href="https://slim-lang.org" rel="nofollow noreferrer">https://slim-lang.org</a>) for years. It’s brevity and clarity have become the norm to me and writing and reading  full html feels a bit exhausting. </p>

<p>I am wondering, is there a way to use slim with twig templates in Craft? Does anyone here use this combination? Would you be willing to share your setup?</p>

<p>Thank you!</p>

<templating>
How can I use slim templates with Craft?
# How can I use slim templates with Craft?

(Asked by: username_0 on 2018-11-07)

Coming from ruby and rails, I’ve been using slim (<https://slim-lang.org>) for years. It’s brevity and clarity have become the norm to me and writing and reading full html feels a bit exhausting.

I am wondering, is there a way to use slim with twig templates in Craft? Does anyone here use this combination? Would you be willing to share your setup?

Thank you!

**Tags:** templating


---

## 1 answers

### Answer by username_1 on 2018-11-07. Score: 1

To answer your question: I think you CAN, but it will not be easy.
Craft is built on top of the Yii framework. It lets you override things (settings, classes) in the config/app.php file that gets installed by default. So, you should be able to change the view renderer to anything you want:
 [
        'view' => [
            'class' => 'craft\web\View',
            'renderers' => [
                'slim' => [
                    'class' => 'path\to\your\slim\ViewRenderer',
                ],
            ],
        ],
    ],
];

Of course, this would require a Yii ViewRenderer based on Slim, which I don't think is  available (yet). You could build it yourself, based on the Twig ViewRenderer used by Craft.
The reason I would not do it, is that Craft has several Twig filters en functions that make your templating life easier. You'd have to create wrappers for those, to be able to use them. I don't think the added complexity of all this weighs up to the advantage of using Slim.

> **Comments:**
> **username_0**: Thank you, seems like that I’ll continue working on the front-end in a separate project and copy the html to craft/twig templates.  

---

