So I work for a publication, and I’m working on a tool to help create better custom article layouts. The CMS is such that the way we do “custom” content is by effectively coding up an entire site, then pasting in everything that’d go inside the <body>
tags (this might seem clunky, but it’s amazing it works considering how complex the entire CMS is — trust me). For obvious reasons, I don’t want to have any <html>
s or <head>
s, and I end up inlining all my css and custom JS into <style>
and <script>
tags at the beginning of the document.
What I’m hoping to have is a middleman setup such that when I’m doing development, I can still have everything wrapped in <html>
, <head>
and <meta>
tags for my own sanity & testing, but come time to do a middleman build
, the final html has:
- The
<html>
,<head>
and<body>
tags stripped out, leaving only what goes in between the<body>
tags. - All the CSS and JS inlined.
Images aren’t an issue since I can FTP those to a separate server we use for static assets (again, I know this sounds nuts, but for a newspaper, this is Star Trek-level stuff).
Any help / thoughts? I found http://blog.ruppel.io/post/52645746944/inline-assets-in-middleman but I don’t really understand how to properly implement it, and it doesn’t solve my problem of stripping out the tags I don’t need. Thanks in advance!