{"id":526,"date":"2016-03-23T23:05:42","date_gmt":"2016-03-24T03:05:42","guid":{"rendered":"http:\/\/www.bemdesign.com\/wordpress\/?p=526"},"modified":"2016-03-24T23:21:24","modified_gmt":"2016-03-25T03:21:24","slug":"shell-scripts-for-easier-website-shell-scaffolding","status":"publish","type":"post","link":"https:\/\/www.bemdesign.com\/wordpress\/2016\/03\/23\/shell-scripts-for-easier-website-shell-scaffolding\/","title":{"rendered":"Shell scripts for easier website shell scaffolding"},"content":{"rendered":"<p>So I&#8217;ve played around with <a href=\"http:\/\/yeoman.io\/\">Yeoman<\/a>.<\/p>\n<p>And I&#8217;ve played with <a href=\"https:\/\/www.npmjs.com\/\">NPM<\/a>, <a href=\"http:\/\/gulpjs.com\/\">Gulp<\/a>, and <a href=\"http:\/\/gruntjs.com\/\">Grunt<\/a>.<\/p>\n<p>There&#8217;s lots of things I like about these tools. But one thing that I dislike about all of them is the general difficulty of building your own customized website scaffolding system with them. And there&#8217;s an over-abundance of dependencies in my opinion. So back to the shell I say!<\/p>\n<p>Here&#8217;s some of my own shell scripts (Bash flavored) to quickly scaffold out common site structures I use frequently.<\/p>\n<hr \/>\n<h3>Generic Scaffold (.NET 4 MVC approach)<\/h3>\n<p>scaffold()<br \/>\n{<br \/>\necho &#8220;Creating Content directory&#8221;<br \/>\nmkdir Content<br \/>\necho &#8220;Creating Scripts directory&#8221;<br \/>\nmkdir Scripts<br \/>\necho &#8220;Moving into Content directory&#8221;<br \/>\ncd Content<br \/>\necho &#8220;Creating assets folder for theme&#8221;<br \/>\nmkdir assets<br \/>\necho &#8220;Moving into Content\/assets directory&#8221;<br \/>\ncd assets<br \/>\necho &#8220;Making css, fonts, and img directories&#8221;<br \/>\nmkdir css<br \/>\nmkdir fonts<br \/>\nmkdir img<br \/>\necho &#8220;And heading back out to the root directory&#8221;<br \/>\ncd ..\/..<br \/>\n}<\/p>\n<h3>Bootstrap Scaffold (.NET 4 MVC approach)*<\/h3>\n<p>*Uses Bower to handle front-end dependencies<\/p>\n<p>scaffold-bootstrap()<br \/>\n{<br \/>\necho &#8220;Creating Content directory&#8221;<br \/>\nmkdir Content<br \/>\necho &#8220;Creating Scripts directory&#8221;<br \/>\nmkdir Scripts<br \/>\necho &#8220;Moving into Content directory&#8221;<br \/>\ncd Content<br \/>\necho &#8220;Creating assets folder for theme&#8221;<br \/>\nmkdir assets<br \/>\necho &#8220;Moving into Content\/assets directory&#8221;<br \/>\ncd assets<br \/>\necho &#8220;Making css, fonts, and img directories&#8221;<br \/>\nmkdir css<br \/>\nmkdir fonts<br \/>\nmkdir img<br \/>\necho &#8220;Using Bower to download front-end dependencies&#8221;<br \/>\necho &#8220;Using Bower to install jQuery#1 &#8211; latest&#8221;<br \/>\nbower install jquery#1<br \/>\necho &#8220;Using Bower to install Bootstrap&#8221;<br \/>\nbower install bootstrap<br \/>\necho &#8220;Using Bower to install FontAwesome&#8221;<br \/>\nbower install fontawesome<br \/>\necho &#8220;Using Bower to install animate.css&#8221;<br \/>\nbower install animate.css<br \/>\necho &#8220;Moving things into place&#8230;&#8221;<br \/>\ncd bower_components\/animate.css<br \/>\nrsync -r animate.min.css ..\/..\/css<br \/>\ncd ..\/bootstrap\/dist<br \/>\ncd css<br \/>\nrsync -r bootstrap.min.css ..\/..\/..\/..\/css<br \/>\ncd ..\/fonts<br \/>\nrsync -r * ..\/..\/..\/..\/fonts<br \/>\ncd ..\/js<br \/>\nrsync -r bootstrap.min.js ..\/..\/..\/..\/..\/..\/Scripts<br \/>\ncd ..\/..\/..\/font-awesome\/css<br \/>\nrsync -r font-awesome.min.css ..\/..\/..\/css<br \/>\ncd ..\/fonts<br \/>\nrsync -r * ..\/..\/..\/fonts<br \/>\ncd ..\/..\/jquery\/dist<br \/>\nrsync -r jquery.min.js ..\/..\/..\/..\/..\/Scripts<br \/>\necho &#8220;And heading back out to the root directory&#8221;<br \/>\ncd ..\/..<br \/>\n}<\/p>\n<hr \/>\n<p>I&#8217;ve added these scripts to my Bash profile (.bash_profile in your user account). For more info on bash scripting, see <a href=\"http:\/\/www.tldp.org\/LDP\/abs\/html\/index.html\">http:\/\/www.tldp.org\/LDP\/abs\/html\/index.html<\/a> or use your favorite web search engine.<\/p>\n<p>I&#8217;ll probably create a deployment-preparation script to copy the appropriate files\/directories into a deployment folder for build\/deployment. Anyway, I found Bash much easier to use to setup my web project scaffolding in the way I want it to be.<\/p>\n<p><strong>Update:<\/strong> Welp here&#8217;s a real world reason to go with shell scripts and minimize your external dependencies: <a href=\"http:\/\/arstechnica.com\/information-technology\/2016\/03\/rage-quit-coder-unpublished-17-lines-of-javascript-and-broke-the-internet\/\">http:\/\/arstechnica.com\/information-technology\/2016\/03\/rage-quit-coder-unpublished-17-lines-of-javascript-and-broke-the-internet\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>So I&#8217;ve played around with Yeoman. And I&#8217;ve played with NPM, Gulp, and Grunt. There&#8217;s lots of things I like about these tools. But one thing that I dislike about all of them is the general difficulty of building your own customized website scaffolding system with them. And there&#8217;s an over-abundance of dependencies in my [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,4],"tags":[49,48],"class_list":["post-526","post","type-post","status-publish","format-standard","hentry","category-technology","category-work","tag-shell-script","tag-tools"],"_links":{"self":[{"href":"https:\/\/www.bemdesign.com\/wordpress\/wp-json\/wp\/v2\/posts\/526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bemdesign.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bemdesign.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bemdesign.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bemdesign.com\/wordpress\/wp-json\/wp\/v2\/comments?post=526"}],"version-history":[{"count":2,"href":"https:\/\/www.bemdesign.com\/wordpress\/wp-json\/wp\/v2\/posts\/526\/revisions"}],"predecessor-version":[{"id":528,"href":"https:\/\/www.bemdesign.com\/wordpress\/wp-json\/wp\/v2\/posts\/526\/revisions\/528"}],"wp:attachment":[{"href":"https:\/\/www.bemdesign.com\/wordpress\/wp-json\/wp\/v2\/media?parent=526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bemdesign.com\/wordpress\/wp-json\/wp\/v2\/categories?post=526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bemdesign.com\/wordpress\/wp-json\/wp\/v2\/tags?post=526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}