{"id":5645,"date":"2014-04-04T15:16:58","date_gmt":"2014-04-04T15:16:58","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/04\/how-to-use-twitter-bootstrap-using-assetic-and-less-in-symfony2-collection-of-common-programming-errors\/"},"modified":"2014-04-04T15:16:58","modified_gmt":"2014-04-04T15:16:58","slug":"how-to-use-twitter-bootstrap-using-assetic-and-less-in-symfony2-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/04\/how-to-use-twitter-bootstrap-using-assetic-and-less-in-symfony2-collection-of-common-programming-errors\/","title":{"rendered":"How to use twitter bootstrap using assetic and less in symfony2?-Collection of common programming errors"},"content":{"rendered":"<p>I can&#8217;t get twitter bootstrap working. I know there is many tutorials and so on, but none of it works for me&#8230;<\/p>\n<p>My composer.json is:<\/p>\n<pre><code>\"require\":\n    [...]\n    \"leafo\/lessphp\": \"dev-master\",\n    \"braincrafted\/bootstrap-bundle\": \"dev-master\",\n    \"twbs\/bootstrap\": \"2.3.*\"\n<\/code><\/pre>\n<p>My assetic configuration is:<\/p>\n<pre><code># Assetic Configuration\nassetic:\n    filters:\n        lessphp:\n            file: %kernel.root_dir%\/..\/vendor\/leafo\/lessphp\/lessc.inc.php\n            apply_to: \"\\.less$\"\n        cssrewrite: ~\n    assets:\n        bootstrap_css:\n            inputs:\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/less\/bootstrap.less\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/less\/responsive.less\n            filters:\n                - lessphp\n                - cssrewrite\n            output: css\/bootstrap.css\n        bootstrap_js:\n            inputs:\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/js\/bootstrap-transition.js\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/js\/bootstrap-alert.js\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/js\/bootstrap-button.js\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/js\/bootstrap-carousel.js\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/js\/bootstrap-collapse.js\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/js\/bootstrap-dropdown.js\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/js\/bootstrap-modal.js\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/js\/bootstrap-tooltip.js\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/js\/bootstrap-popover.js\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/js\/bootstrap-scrollspy.js\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/js\/bootstrap-tab.js\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/js\/bootstrap-typeahead.js\n                - %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/js\/bootstrap-affix.js\n            output: js\/bootstrap.js\n<\/code><\/pre>\n<p>And finally <code>::base.html.twig<\/code>:<\/p>\n<pre><code>{% block stylesheets %}\n    \n{% endblock %}\n\n{% block javascripts %}\n    \n{% endblock %}\n<\/code><\/pre>\n<p>I&#8217;m trying include js ans css with different ways, for example:<\/p>\n<pre><code>{% stylesheets '%kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/less\/bootstrap.less' %}\n    \n{% endstylesheets %}\n<\/code><\/pre>\n<p>or<\/p>\n<pre><code>{% stylesheets '@bootstrap_css' %}\n    \n{% endstylesheets %}\n<\/code><\/pre>\n<p>but it still not working and I&#8217;m getting 404 errors for bootstrap.css and bootstrap.js.<\/p>\n<p>Whats wrong with my config? I&#8217;m using wamp server on windows 7 64bit.<\/p>\n<p>The only way to get it working was to use cli command <code>assetic:dump<\/code> but I think it&#8217;s not correct way to do this on dev environment.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I can&#8217;t get twitter bootstrap working. I know there is many tutorials and so on, but none of it works for me&#8230; My composer.json is: &#8220;require&#8221;: [&#8230;] &#8220;leafo\/lessphp&#8221;: &#8220;dev-master&#8221;, &#8220;braincrafted\/bootstrap-bundle&#8221;: &#8220;dev-master&#8221;, &#8220;twbs\/bootstrap&#8221;: &#8220;2.3.*&#8221; My assetic configuration is: # Assetic Configuration assetic: filters: lessphp: file: %kernel.root_dir%\/..\/vendor\/leafo\/lessphp\/lessc.inc.php apply_to: &#8220;\\.less$&#8221; cssrewrite: ~ assets: bootstrap_css: inputs: &#8211; %kernel.root_dir%\/..\/vendor\/twbs\/bootstrap\/less\/bootstrap.less &#8211; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5645","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5645"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5645\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}