Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-07T16:15:06.080Z
Answers.Text: 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.
Answers.UserDisplayName: aaandre
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-07T12:45:19.473Z
Answers.LastActivityDate: 2018-11-07T12:45:19.473Z
Answers.UserDisplayName: Paul
Body: <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>
  
Tags: <templating>
Title: How can I use slim templates with Craft?
ThreadText: # 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`](https://docs.craftcms.com/v3/config/#application-config) file that gets installed by default. So, you should be able to change the view renderer to anything you want:
  
  ```
  <?php
  
  return [
      'components' => [
          '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.  
  
  ---
  
  