{"id":3292,"date":"2014-12-23T10:51:13","date_gmt":"2014-12-23T12:51:13","guid":{"rendered":"https:\/\/www.kadunew.com\/blog\/?p=3292"},"modified":"2014-12-23T10:51:13","modified_gmt":"2014-12-23T12:51:13","slug":"pre-processadores-html","status":"publish","type":"post","link":"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html","title":{"rendered":"Pr\u00e9-processadores HTML"},"content":{"rendered":"<p>Escrever c\u00f3digo HTML \u00e9 de certa forma uma tarefa cansativa. Um exemplo \u00e9 o fechamento de tags tais como <em>div<\/em>, <em>strong<\/em>, <em>ul<\/em>, <em>li<\/em>&#8230;, tarefa relativamente simples e r\u00e1pida, mas imagina se voc\u00ea pudesse escrever somente a tag de abertura dos seus elementos? Com certeza ganharia um tempo preciso. <strong>Isso \u00e9 poss\u00edvel com os pr\u00e9-processadores HTML<\/strong>.<\/p>\n<p>Pr\u00e9-processadores s\u00e3o programas que recebem um texto e ap\u00f3s ser compilado geram uma sa\u00edda que pode ser interpretada pelo seu navegador. Hoje em dia \u00e9 muito comum o uso de pr\u00e9-processadores para CSS (<a href=\"https:\/\/www.kadunew.com\/blog\/css\/less-programando-no-css\" title=\"Programe CSS com LESS\">Escrevi um artigo falando sobre o LESS<\/a>), por\u00e9m h\u00e1 esse tipo de ferramenta para HTML tamb\u00e9m.<\/p>\n<h2>Alguns pr\u00e9-processadores HTML<\/h2>\n<ul>\n<li><a href=\"http:\/\/daringfireball.net\/projects\/markdown\/\" title=\"Ddaringfireball\" target=\"_blank\">Markdown<\/a><\/li>\n<li><a href=\"http:\/\/haml.info\/\" title=\"Haml\" target=\"_blank\">HAML<\/a><\/li>\n<li><a href=\"http:\/\/slim-lang.com\/\" title=\"Slim\" target=\"_blank\">Slim<\/a><\/li>\n<li><a href=\"http:\/\/jade-lang.com\/\" title=\"Jade\" target=\"_blank\">Jade<\/a><\/li>\n<li><a href=\"http:\/\/coffeekup.org\/\" title=\"coffeekup\" target=\"_blank\">CoffeeKup<\/a><\/li>\n<\/ul>\n<p>No exemplo abaixo criamos uma div com atributo id igual a <em>conte\u00fado<\/em>. Para informar ao pr\u00e9-processador que queremos essa div conte\u00fado dentro do elemento body perceba que indentamos o texto <em>#conteudo<\/em> mais para dentro. A mesma coisa foi feita com o texto <em>T\u00edtulo exemplo<\/em> e o restante.<\/p>\n<pre class=\"brush: xml; title: linguagem do pr\u00e9-processador; notranslate\" title=\"linguagem do pr\u00e9-processador\">\r\nbody\r\n #conteudo\r\n   h1 T\u00edtulo exemplo\r\n   .box \r\n      p Par\u00e1grafo\r\n<\/pre>\n<p>Exemplo de sa\u00edda ap\u00f3s ser compilado<\/p>\n<pre class=\"brush: xml; title: linguagem do pr\u00e9-processador; notranslate\" title=\"linguagem do pr\u00e9-processador\">\r\n&lt;body&gt;\r\n  &lt;div id=&quot;conteudo&quot;&gt;\r\n     &lt;h1&gt;Markup examples&lt;\/h1&gt;\r\n       &lt;div class=&quot;box&quot;&gt;\r\n          &lt;p&gt;Par\u00e1grafo&lt;\/p&gt;\r\n       &lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n&lt;\/body&gt;\r\n<\/pre>\n<p>Outro exemplo usando Slim. Na aba <em>Slim<\/em> a sintaxe do compilador Slim, e na aba <em>Result<\/em> o resultado final<\/p>\n<div data-height=\"268\" data-theme-id=\"0\" data-slug-hash=\"vEKwEm\" data-default-tab=\"html\" data-user=\"kadunew\" class='codepen'>\n<pre><code>nav\r\n    ul\r\n        li\r\n            a href=&#x27;#&#x27; Home\r\n        li\r\n            a href=&#x27;#&#x27; About\r\n        li\r\n            a href=&#x27;#&#x27; Clients\r\n        li\r\n            a href=&#x27;#&#x27; Contact Us<\/code><\/pre>\n<p>See the Pen <a href='http:\/\/codepen.io\/kadunew\/pen\/vEKwEm\/'>vEKwEm<\/a> by Carlos Eduardo (<a href='http:\/\/codepen.io\/kadunew'>@kadunew<\/a>) on <a href='http:\/\/codepen.io'>CodePen<\/a>.<\/p>\n<\/div>\n<p><script async src=\"\/\/assets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<p>Voc\u00ea pode usar o site <a href=\"te http:\/\/codepen.io\/\" title=\"codepen\" target=\"_blank\">http:\/\/codepen.io<\/a> para testar alguns dos pr\u00e9-processadores. Ao entrar no site clique em <em>New Pen<\/em> e depois configure um pr\u00e9-processador do seu gosto (conforme destaque na imagem abaixo)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.kadunew.com\/blog\/wp-content\/uploads\/2014\/12\/configurando-preprocessador.png\" alt=\"Configurando Pr\u00e9-processador\" width=\"400\" height=\"345\" class=\"aligncenter size-full wp-image-3296\" srcset=\"https:\/\/www.kadunew.com\/blog\/wp-content\/uploads\/2014\/12\/configurando-preprocessador.png 400w, https:\/\/www.kadunew.com\/blog\/wp-content\/uploads\/2014\/12\/configurando-preprocessador-300x258.png 300w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/p>\n<p>Curta a p\u00e1gina do <a href=\"https:\/\/www.facebook.com\/pages\/Kadunew-Artigos-e-tutoriais-sobre-Web-Design\/787883281258323\" title=\"Artigos e tutoriais sobre Web Design\" target=\"_blank\">blog kadunew<\/a> no Facebook. Siga-me no Twitter: <a href=\"http:\/\/twitter.com\/kadunew\" rel=\"nofollow\">@kadunew<\/a> ou assine nosso <a href=\"https:\/\/www.kadunew.com\/blog\/feed\">Feed<\/a> e fique por dentro de todas atualiza\u00e7\u00f5es aqui do blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Escrever c\u00f3digo HTML \u00e9 de certa forma uma tarefa cansativa. Um exemplo \u00e9 o fechamento de tags tais como div, strong, ul, li&#8230;, tarefa relativamente simples e r\u00e1pida, mas imagina se voc\u00ea pudesse escrever somente a tag de abertura dos seus elementos? Com certeza ganharia um tempo preciso. Isso \u00e9 poss\u00edvel com os pr\u00e9-processadores HTML. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[],"class_list":["post-3292","post","type-post","status-publish","format-standard","hentry","category-html"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Pr\u00e9-processadores HTML<\/title>\n<meta name=\"description\" content=\"Pr\u00e9-processadores HTML acelera a cria\u00e7\u00e3o de sua marca\u00e7\u00e3o, reduz sua sintaxe, automatiza a escrita de seus elementos HTML e muito mais!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pr\u00e9-processadores HTML\" \/>\n<meta property=\"og:description\" content=\"Pr\u00e9-processadores HTML acelera a cria\u00e7\u00e3o de sua marca\u00e7\u00e3o, reduz sua sintaxe, automatiza a escrita de seus elementos HTML e muito mais!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html\" \/>\n<meta property=\"og:site_name\" content=\"KADUNEW\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-23T12:51:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.kadunew.com\/blog\/wp-content\/uploads\/2014\/12\/configurando-preprocessador.png\" \/>\n\t<meta property=\"og:image:width\" content=\"400\" \/>\n\t<meta property=\"og:image:height\" content=\"345\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Kadu Oliveira\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kadu Oliveira\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html\",\"url\":\"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html\",\"name\":\"Pr\u00e9-processadores HTML\",\"isPartOf\":{\"@id\":\"https:\/\/www.kadunew.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.kadunew.com\/blog\/wp-content\/uploads\/2014\/12\/configurando-preprocessador.png\",\"datePublished\":\"2014-12-23T12:51:13+00:00\",\"dateModified\":\"2014-12-23T12:51:13+00:00\",\"author\":{\"@id\":\"https:\/\/www.kadunew.com\/blog\/#\/schema\/person\/07b2297c4825efbd1e9f2a1018926b05\"},\"description\":\"Pr\u00e9-processadores HTML acelera a cria\u00e7\u00e3o de sua marca\u00e7\u00e3o, reduz sua sintaxe, automatiza a escrita de seus elementos HTML e muito mais!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html#primaryimage\",\"url\":\"https:\/\/www.kadunew.com\/blog\/wp-content\/uploads\/2014\/12\/configurando-preprocessador.png\",\"contentUrl\":\"https:\/\/www.kadunew.com\/blog\/wp-content\/uploads\/2014\/12\/configurando-preprocessador.png\",\"width\":400,\"height\":345,\"caption\":\"Configurando Pr\u00e9-processador\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.kadunew.com\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HTML\",\"item\":\"https:\/\/www.kadunew.com\/blog\/category\/html\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Pr\u00e9-processadores HTML\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.kadunew.com\/blog\/#website\",\"url\":\"https:\/\/www.kadunew.com\/blog\/\",\"name\":\"KADUNEW\",\"description\":\"Artigos sobre Front-End e Programa\u00e7\u00e3o web\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.kadunew.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.kadunew.com\/blog\/#\/schema\/person\/07b2297c4825efbd1e9f2a1018926b05\",\"name\":\"Kadu Oliveira\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.kadunew.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/780660fded589936b30467c54c99d51a?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/780660fded589936b30467c54c99d51a?s=96&r=g\",\"caption\":\"Kadu Oliveira\"},\"sameAs\":[\"https:\/\/www.kadunew.com\/blog\"],\"url\":\"https:\/\/www.kadunew.com\/blog\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pr\u00e9-processadores HTML","description":"Pr\u00e9-processadores HTML acelera a cria\u00e7\u00e3o de sua marca\u00e7\u00e3o, reduz sua sintaxe, automatiza a escrita de seus elementos HTML e muito mais!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html","og_locale":"pt_BR","og_type":"article","og_title":"Pr\u00e9-processadores HTML","og_description":"Pr\u00e9-processadores HTML acelera a cria\u00e7\u00e3o de sua marca\u00e7\u00e3o, reduz sua sintaxe, automatiza a escrita de seus elementos HTML e muito mais!","og_url":"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html","og_site_name":"KADUNEW","article_published_time":"2014-12-23T12:51:13+00:00","og_image":[{"width":400,"height":345,"url":"https:\/\/www.kadunew.com\/blog\/wp-content\/uploads\/2014\/12\/configurando-preprocessador.png","type":"image\/png"}],"author":"Kadu Oliveira","twitter_misc":{"Escrito por":"Kadu Oliveira","Est. tempo de leitura":"2 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html","url":"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html","name":"Pr\u00e9-processadores HTML","isPartOf":{"@id":"https:\/\/www.kadunew.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html#primaryimage"},"image":{"@id":"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html#primaryimage"},"thumbnailUrl":"https:\/\/www.kadunew.com\/blog\/wp-content\/uploads\/2014\/12\/configurando-preprocessador.png","datePublished":"2014-12-23T12:51:13+00:00","dateModified":"2014-12-23T12:51:13+00:00","author":{"@id":"https:\/\/www.kadunew.com\/blog\/#\/schema\/person\/07b2297c4825efbd1e9f2a1018926b05"},"description":"Pr\u00e9-processadores HTML acelera a cria\u00e7\u00e3o de sua marca\u00e7\u00e3o, reduz sua sintaxe, automatiza a escrita de seus elementos HTML e muito mais!","breadcrumb":{"@id":"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html#primaryimage","url":"https:\/\/www.kadunew.com\/blog\/wp-content\/uploads\/2014\/12\/configurando-preprocessador.png","contentUrl":"https:\/\/www.kadunew.com\/blog\/wp-content\/uploads\/2014\/12\/configurando-preprocessador.png","width":400,"height":345,"caption":"Configurando Pr\u00e9-processador"},{"@type":"BreadcrumbList","@id":"https:\/\/www.kadunew.com\/blog\/html\/pre-processadores-html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.kadunew.com\/blog"},{"@type":"ListItem","position":2,"name":"HTML","item":"https:\/\/www.kadunew.com\/blog\/category\/html"},{"@type":"ListItem","position":3,"name":"Pr\u00e9-processadores HTML"}]},{"@type":"WebSite","@id":"https:\/\/www.kadunew.com\/blog\/#website","url":"https:\/\/www.kadunew.com\/blog\/","name":"KADUNEW","description":"Artigos sobre Front-End e Programa\u00e7\u00e3o web","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.kadunew.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Person","@id":"https:\/\/www.kadunew.com\/blog\/#\/schema\/person\/07b2297c4825efbd1e9f2a1018926b05","name":"Kadu Oliveira","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.kadunew.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/780660fded589936b30467c54c99d51a?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/780660fded589936b30467c54c99d51a?s=96&r=g","caption":"Kadu Oliveira"},"sameAs":["https:\/\/www.kadunew.com\/blog"],"url":"https:\/\/www.kadunew.com\/blog\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.kadunew.com\/blog\/wp-json\/wp\/v2\/posts\/3292"}],"collection":[{"href":"https:\/\/www.kadunew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kadunew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kadunew.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kadunew.com\/blog\/wp-json\/wp\/v2\/comments?post=3292"}],"version-history":[{"count":11,"href":"https:\/\/www.kadunew.com\/blog\/wp-json\/wp\/v2\/posts\/3292\/revisions"}],"predecessor-version":[{"id":3304,"href":"https:\/\/www.kadunew.com\/blog\/wp-json\/wp\/v2\/posts\/3292\/revisions\/3304"}],"wp:attachment":[{"href":"https:\/\/www.kadunew.com\/blog\/wp-json\/wp\/v2\/media?parent=3292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kadunew.com\/blog\/wp-json\/wp\/v2\/categories?post=3292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kadunew.com\/blog\/wp-json\/wp\/v2\/tags?post=3292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}