{"id":230,"date":"2013-09-16T12:11:07","date_gmt":"2013-09-16T10:11:07","guid":{"rendered":"http:\/\/hesmid.nl\/test\/?p=230"},"modified":"2018-12-10T14:31:17","modified_gmt":"2018-12-10T13:31:17","slug":"wordpress-with-git-wp-skeleton-and-roots-101","status":"publish","type":"post","link":"https:\/\/hesmid.nl\/test\/wordpress-with-git-wp-skeleton-and-roots-101\/","title":{"rendered":"WordPress with GIT, WP-Skeleton and Roots 101"},"content":{"rendered":"<p>Goals: &#8211; Keep a local WordPress \u00a0installation under version control (but ignore WordPress core files) &#8211; Use WP-Skeleton (wordpress core as submodule in separated folder, content and config files in root) &#8211; Use\u00a0the starter theme Roots 101 &#8211; Deploy to a staging and production server (depending on the current Git branch?) &#8211; Keep uploads out of version control, sync them separately &#8211; Use a\u00a0good DB migration strategy &#8211; If possible: automate repetitive tasks<!--more--><\/p>\n<h4>Assumptions<\/h4>\n<p>&#8211; Windows 7 &#8211; WAMP &#8211; Cygwin (linux environment) &#8211; Git, (Ruby, Compass, Grunt, Rsync) &#8211; Bitbucket account &#8211; SSH access to server (shared host) &#8211; SSH-keys set up for your servers and Bitbucket<\/p>\n<h4>1. Create the WP-skeleton directory structure<\/h4>\n<p><em>If you set up this project recently, you can use an existing repo with WP-Skeleton and roots. See 1b.<\/em><\/p>\n<ul>\n<li>Clone Jaquith\u2019s\u00a0<a href=\"https:\/\/github.com\/markjaquith\/WordPress-Skeleton\">WordPress-Skeleton<\/a>\u00a0<span style=\"line-height: 1.5;\">in Bitbucket\u00a0<\/span><\/li>\n<li><strong>Note:<\/strong> for a clean start don&#8217;t fork the repo directly, but first clone the repository locally, remove the history and then push it to your new bitbucket repo.<\/li>\n<li>\n<pre lang=\"bash\">mkdir temp\ncd temp\ngit clone git@bitbucket.org:[USERNAME]\/wordpress-skeleton-[version].git .\nrm -rf .git\nrm .gitmodules\nrm -rf wp\ngit init\ngit add .\ngit submodule add https:\/\/github.com\/WordPress\/WordPress.git wp\ncd wp\ngit tag\ngit checkout [version]\ncd ..\ngit add .\ngit commit -m'setup skeleton'<\/pre>\n<\/li>\n<\/ul>\n<p>Create a new repository with your project name on bitbucket. Then push:<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>\n<pre lang=\"bash\">git remote add origin git@bitbucket.org:[username]\/[projectname].git\ngit push -u origin --all\n\n#Of course there should be an easier way to remove history, but for now this works<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Remove the temp folder created in the steps above<br \/>\nNow create a project folder and clone the repository into a subfolder (e.g. www). Recursively, because the wp submodule should also be cloned (don&#8217;t need to add\u00a0&#8211;recursive if\u00a0you added a localized WP installation as descrived above).<\/p>\n<pre lang=\"bash\">git clone --recursive git@bitbucket.org:USERNAME\/PROJECTNAME.git www<\/pre>\n<h4>1b. Headstart from existing repo<\/h4>\n<ul>\n<li>Clone the repo with WP-Skeleton and the roots theme in a temp folder<\/li>\n<li>rename the theme folder to [project]-theme.<\/li>\n<li>Change the style.css of the theme with your theme name and details<\/li>\n<li>remove the contents of readme.md in the root (not roots!) folder<\/li>\n<li>If using localized\u00a0WP:\n<ul>\n<li>Remove WP submodule, and add WP localized as normal files to git repo\u00a0(see also the post with <a title=\"Git snippets and tricks\" href=\"https:\/\/hesmid.nl\/test\/web-development-2\/git-snippets-and-tricks\/\">Git snippets<\/a>)<\/li>\n<\/ul>\n<\/li>\n<li>Create a new repository with your project name on bitbucket. Then push:<\/li>\n<li>\n<pre lang=\"bash\">git remote add origin git@bitbucket.org:[username]\/[projectname].git\ngit push -u origin --all<\/pre>\n<\/li>\n<li>Remove the temp folder created in the steps above<br \/>\nNow create a project folder and clone the repository into a subfolder (e.g. www). Recursively, because the wp submodule should also be cloned.<\/p>\n<pre lang=\"bash\">git clone --recursive git@bitbucket.org:USERNAME\/PROJECTNAME.git www<\/pre>\n<\/li>\n<\/ul>\n<h4>2. Local Database and aliases<\/h4>\n<ul>\n<li>Create a local database. Doesn&#8217;t have to be the same name as on the server, since we are going to use a local config for wordpress<\/li>\n<li><span style=\"line-height: 1.5;\">If the project directory is outside the WAMP directory, <\/span><a style=\"line-height: 1.5;\" title=\"Configure a virtual directory using WAMP\" href=\"https:\/\/hesmid.nl\/test\/workflow\/third-post\/\">create an alias<\/a><\/li>\n<\/ul>\n<h4>3. Configure\u00a0Wordpress files<\/h4>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Rename\u00a0the local-config-sample.php to local-config.php<\/li>\n<li><span style=\"line-height: 1.5;\">Fill in the local db name and credentials<\/span><\/li>\n<li>While we&#8217;re at it, add these lines to enable debugging in the local environment\n<pre lang=\"php\">\/\/ debug for local development\ndefine('WP_DEBUG', true);\ndefine('WP_DEBUG_LOG', true);\ndefine('SAVEQUERIES', true);\n\nini_set('log_errors',TRUE);\nini_set('error_reporting', E_ALL);\nini_set('error_log', dirname(__FILE__) . '\/error_log.txt');<\/pre>\n<\/li>\n<li><span style=\"line-height: 1.5;\">Edit wp-config.php: <span style=\"line-height: 1.5;\">Create salted phrases:\u00a0<\/span><a style=\"line-height: 1.5;\" href=\"https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/\">https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/ <\/a><\/span><\/li>\n<li><span style=\"line-height: 1.5;\">Change the table prefix (if I remember well it is best to not use capitals, for some reason) . Use for instance this <a href=\"http:\/\/www.whatsmyip.org\/random-password-generator\/\">tool<\/a><br \/>\n<\/span><span style=\"color: #666666; font-family: monospace; font-size: 14px; line-height: 18px; white-space: pre-wrap;\"><span style=\"color: #666666; font-family: monospace; font-size: 14px; line-height: 18px; white-space: pre-wrap;\"><span style=\"color: #666666; font-family: monospace; font-size: 14px; line-height: 18px; white-space: pre-wrap;\">$table_prefix \u00a0= &#8216;wp09g3h4kg_&#8217;;<br \/>\n<\/span><\/span><\/span><\/li>\n<li><span style=\"line-height: 1.5;\">Because I want to use a staging and a production server, which will have different DB credentials, I added this code to wp-config.php:<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre lang=\"php\">===================================================\n\/\/ Load database info and local development parameters\n\/\/ ===================================================\nif ( file_exists( dirname( __FILE__ ) . '\/local-config.php' ) ) {\n   define( 'WP_LOCAL_DEV', true );\n   include( dirname( __FILE__ ) . '\/local-config.php' );\n} else {\n   define( 'WP_LOCAL_DEV', false );\n   if (file_exists( dirname( __FILE__ ) . '\/.staging' ) ) { \/\/ STAGING SERVER\n      define( 'DB_NAME', '%%STAGING_DB_NAME%%' );\n      define( 'DB_USER', '%%STAGING_DB_USER%%' );\n      define( 'DB_PASSWORD', '%%STAGING_DB_PASSWORD%%' );\n      define( 'DB_HOST', '%%STAGING_DB_HOST%%' ); \/\/ Probably 'localhost'\n   } else {\n      define( 'DB_NAME', '%%DB_NAME%%' );\n      define( 'DB_USER', '%%DB_USER%%' );\n      define( 'DB_PASSWORD', '%%DB_PASSWORD%%' );\n      define( 'DB_HOST', '%%DB_HOST%%' ); \/\/ Probably 'localhost'\n   }\n}<\/pre>\n<ul>\n<li>Don&#8217;t forget to add a .staging file to the repo root directory on the staging server<\/li>\n<li>I also ended up adding this to wp-config.php, because the local url is different from the server url\n<pre lang=\"php\">if ( WP_LOCAL_DEV ) {\n   define( 'WP_CONTENT_URL', 'http:\/\/' . $_SERVER['HTTP_HOST'] . '\/wptest7\/content' );\n} else {\n   define( 'WP_CONTENT_URL', 'http:\/\/' . $_SERVER['HTTP_HOST'] . '\/content' );\n}<\/pre>\n<\/li>\n<li>You may also add some other usefull stuff to the wp-config.php:\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Increase the memory limit.\n<pre lang=\"php\">define('WP_MEMORY_LIMIT', '64M')<\/pre>\n<\/li>\n<li>FTP\/SSH Constants:<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre lang=\"php\">\/\/ forces the filesystem method: \"direct\", \"ssh\", \"ftpext\", or \"ftpsockets\"\ndefine('FS_METHOD', 'ftpext');\n\/\/ absolute path to root installation directory\ndefine('FTP_BASE', '\/path\/to\/wordpress\/');\n\/\/ absolute path to \"wp-content\" directory\ndefine('FTP_CONTENT_DIR', '\/path\/to\/wordpress\/wp-content\/');\n\/\/ absolute path to \"wp-plugins\" directory\ndefine('FTP_PLUGIN_DIR ', '\/path\/to\/wordpress\/wp-content\/plugins\/');\n\/\/ absolute path to your SSH public key\ndefine('FTP_PUBKEY', '\/home\/username\/.ssh\/id_rsa.pub');\n\/\/ absolute path to your SSH private key\ndefine('FTP_PRIVKEY', '\/home\/username\/.ssh\/id_rsa');\n\/\/ either your FTP or SSH username\ndefine('FTP_USER', 'username');\n\/\/ password for FTP_USER username\ndefine('FTP_PASS', 'password');\n\/\/ hostname:port combo for your SSH\/FTP server\ndefine('FTP_HOST', 'ftp.example.org:21'); \n<\/pre>\n<\/li>\n<li>By default, WordPress will save an unlimited number of revisions, however this is generally not needed. It is better to reduce this limit to something more practical such as two or three. You can do this by adding the following code to your wp-config.php file:\n<div id=\"highlighter_108801\" class=\"syntaxhighlighter nogutter \">\n<div class=\"lines\">\n<div class=\"line alt1\"><code class=\"plain\">define( <\/code><code class=\"string\">'WP_POST_REVISIONS'<\/code><code class=\"plain\"><code class=\"plain\">, 3 );<\/code><\/code><\/div>\n<\/div>\n<\/div>\n<\/li>\n<li>Edit .gitignore to ignore . staging (and .production)<\/li>\n<li>Remove the symlink to uploads and replace it with a directory uploads. <strong style=\"line-height: 1.5;\">Note:<\/strong><span style=\"line-height: 1.5;\"> I guess it would be nice to symlink to ..\/shared\/content\/uploads and keep the uploads out of the git repo, but on my local install apache couldn&#8217;t follow the symlink (for whatever reason).\u00a0<\/span><\/li>\n<li><span style=\"line-height: 1.5;\">It is now probably a good idea to ignore the uploads folder. so add this to your .gitignore: <\/span>\n<pre><span style=\"color: #666666; font-family: monospace; font-size: 14px; line-height: 18px; white-space: pre-wrap;\">\/content\/uploads\/<\/span><\/pre>\n<\/li>\n<\/ul>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong><strong>.GITIGNORE<br \/>\n<\/strong><\/strong>Consider adding the following files to git.ignore<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre lang=\"bash\">.staging\n.production\n*.log\n.htaccess\n.DS_Store\n*.bak\n*.swp\nThumbs.db\n*.log\n\/*DB backups (folders depend on the plugin you use)*\/\nwp-content\/backup-db\/\n\/*Cache files (folders depend on the cache plugin you use)*\/\n\nwp-content\/advanced-cache.php\nwp-content\/wp-cache-config.php\nwp-content\/cache\/*\nwp-content\/cache\/supercache\/*\nwp-content\/cache\/\n\n*\/+ the files in .gitignore of roots theme*\/\n\n*\/specific live-only OR development-only plugins*\/<\/pre>\n<ul>\n<li><strong><span style=\"color: #ff0000;\">Note:<\/span>\u00a0<\/strong>Since roots 7.0 several assets are ignored. If you deploy with Git like I do, remove these files from .gitignore:\n<pre lang=\"bash\">\/assets\/vendor\/*\n\/assets\/css\/main.css.map\n\/assets\/css\/*main*.css\n\/assets\/js\/*scripts*.js\n\/assets\/js\/vendor\/modernizr.min.js\n\/assets\/manifest.json\n<\/pre>\n<\/li>\n<li><strong><span style=\"color: #ff0000;\">TODO:<\/span>\u00a0<\/strong>come up with a strategy to sync the uploads<\/li>\n<li>Add and commit the modified files<\/li>\n<\/ul>\n<h4>4.\u00a0Install wordpress locally<\/h4>\n<p>&#8211; open up the url localhost\/project\/wp\/wp-admin in your browser<br \/>\n&#8211; Do the install<br \/>\n&#8211; Log in<br \/>\n&#8211; Change the site address to the root folder (instead of the sub folder wp)<br \/>\n&#8211; Optional: change tagline, time format, timezone<br \/>\n&#8211; Change permalinks to postname (preset)<br \/>\n&#8211; If htaccess not writable: changer permissions to 666 (temporarily After changes are made, change it back to 644)<br \/>\n&#8211; Add and commit the changes (to .htaccess) with message: \u2018changed permalinks and site url\u2019<br \/>\n<span style=\"line-height: 1.5;\">&#8211; Push to bitbucket<\/span><\/p>\n<h4>5. Install Roots 101 via a git branch<\/h4>\n<pre lang=\"bash\">- git checkout -b roots\n- git branch\n- cd content\/themes<\/pre>\n<p>Now clone a theme. We will use Roots 101. You can clone it into a folder named after your project. the default name of the folder is roots.<\/p>\n<pre lang=\"bash\">git clone https:\/\/github.com\/roots\/roots.git THEMENAME<\/pre>\n<ul>\n<li>Copy the entries in the .gitignore of the theme and paste it to\u00a0the .gitignore in the root (adjust paths if necessary<\/li>\n<li><span style=\"line-height: 1.5;\">Now remove the .git directory and all the other .git files:<br \/>\n<\/span><span style=\"background-color: #f5f5f5; color: #666666; font-family: monospace; font-size: 14px; line-height: 18px; white-space: pre-wrap;\">cd PROJECTNAME<br \/>\n<\/span><span style=\"background-color: #f5f5f5; color: #666666; font-family: monospace; font-size: 14px; line-height: 18px; white-space: pre-wrap;\">rm -rf .git<br \/>\n<\/span><span style=\"background-color: #f5f5f5; color: #666666; font-family: monospace; font-size: 14px; line-height: 18px; white-space: pre-wrap;\"><span style=\"background-color: #f5f5f5; color: #666666; font-family: monospace; font-size: 14px; line-height: 18px; white-space: pre-wrap;\">rm .gitignore<\/span><\/span><\/li>\n<li>Edit the style.css of the theme\n<pre lang=\"css\">\/*\nTheme Name: THEME NAME\nTheme URI: WEBSITE URL\nDescription: Custom theme for ..\nVersion: 1.0.0\nAuthor: YOUR NAME\nAuthor URI: YOUR URL\n\nLicense: MIT License\nLicense URI: <a class=\"linkification-ext\" title=\"Linkification: http:\/\/opensource.org\/licenses\/MIT\" href=\"http:\/\/opensource.org\/licenses\/MIT\">http:\/\/opensource.org\/licenses\/MIT<\/a>\n*\/<\/pre>\n<\/li>\n<li>Replace screenshot.png in the root directory of the theme with the logo of the project<\/li>\n<\/ul>\n<p><span style=\"line-height: 1.5;\">Add and commit the changes<\/span><\/p>\n<pre lang=\"bash\">git status\ngit add .\ngit commit -m'Addition of the Roots 101 Theme'<\/pre>\n<h4>6. Setup Roots 101<\/h4>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>Also install GIT for windows, since the bower installer needs it. Make sure to choose the option where git is added to the windows path (enabling it from command prompt)<\/li>\n<li>If Grunt isn&#8217;t installed yet, do it now (see also\u00a0<a title=\"Grunt\" href=\"https:\/\/hesmid.nl\/test\/workflow\/grunt\/\">this<\/a> post)<\/li>\n<li>go to the roots directory and\u00a0install the dependencies for Roots contained in <code>package.json<\/code> by running the following from the Roots theme directory.<br \/>\n<strong><strong>Note: this doesn&#8217;t work with cygwin for me. I need to run the command from a windows command prompt. Also: run command prompt as admin<\/strong><\/strong>NOTE 2: if there is already a\u00a0node_modules folder (from a previous installation), remove it first!<\/li>\n<li>\n<pre>npm install<\/pre>\n<\/li>\n<li>Try the available Grunt commands:<br \/>\ngrunt dev &#8211;\u00a0<span style=\"color: #333333;\"><span style=\"color: #333333;\">Compile LESS to CSS, concatenate and validate JS<\/span><\/span><br \/>\n(I had permission problems on my new windows 7 install. Setting the noacl option in fstab solved it. see <a title=\"cygwin permissions\" href=\"https:\/\/hesmid.nl\/test\/web-development-2\/cygwin-permissions\/\">this post<\/a>)grunt watch &#8211;\u00a0<span style=\"color: #333333;\">Compile assets when file changes are made<\/span><br \/>\ngrunt build &#8211;\u00a0<span style=\"color: #333333;\"><span style=\"color: #333333;\">Create minified assets that are used on non-development environments<\/span><\/span><\/li>\n<li><span style=\"line-height: 1.5;\">Some additional info regarding <\/span><strong style=\"line-height: 1.5;\">Roots v7.0.\u00a0<\/strong><br style=\"line-height: 1.5;\" \/><strong style=\"line-height: 1.5;\">Note:<\/strong><span style=\"line-height: 1.5;\"> I opted for the old Roots approach concerning the building of minified assets. see next part (&#8216;Adding *.min.css &#8230;&#8217;)<br \/>\n<\/span><del>You need to add\u00a0<code>define('WP_ENV', 'development');<\/code><\/del><del>\u00a0to your wp-config.php, while developing, so your Roots won&#8217;t look for the minified version.<\/p>\n<p><code style=\"color: #333333;\">grunt dev<\/code>\u00a0basically will do all the work but* minifying;<br \/>\n<code style=\"color: #333333;\">grunt watch<\/code>\u00a0will run\u00a0<code style=\"color: #333333;\">grunt dev<\/code>\u00a0when something is modified;<br \/>\n<code style=\"color: #333333;\">grunt build<\/code>\u00a0will do all the work + minify, so you can send your project to your production server.<\/p>\n<p><\/del><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li style=\"color: #222222;\">The process:<\/li>\n<\/ul>\n<ol style=\"color: #222222;\">\n<li><del>Add\u00a0<code>define('WP_ENV', 'development');<\/code>\u00a0to wp-config.php;<\/del><\/li>\n<li>Work on your project with\u00a0<code style=\"color: #333333;\">grunt watch<\/code>;<\/li>\n<li>Finishes the project -&gt; runs\u00a0<code style=\"color: #333333;\">grunt build<\/code>;<\/li>\n<li>Send the project to production server (where the WP_ENV won&#8217;t be &#8220;development&#8221;).<\/li>\n<\/ol>\n<aside class=\"quote\" style=\"color: #222222;\" data-topic=\"1952\" data-slug=\"how-to-correctly-add-bxslider-to-my-theme\" data-post=\"12\">\n<div class=\"title\">\n<div class=\"quote-controls\" style=\"color: #919191;\">\n<aside class=\"quote\" style=\"color: #222222;\" data-topic=\"1952\" data-slug=\"how-to-correctly-add-bxslider-to-my-theme\" data-post=\"12\">\n<h4 class=\"title\">Adding *.min.css and *.min.script to Grunt Watch<\/h4>\n<ul>\n<li class=\"title\">Taken from: <a href=\"http:\/\/discourse.roots.io\/t\/add-x-min-css-x-min-script-to-watch\/1920&amp;hellip\">http:\/\/discourse.roots.io\/t\/add-x-min-css-x-min-script-to-watch\/1920&amp;hellip<\/a>Roots 7.0 is configured to have Grunt create minified <em>and<\/em> unminified assets depending on how you run <code><code>grunt<\/code><\/code>Head over to your <a href=\"https:\/\/github.com\/roots\/roots\/blob\/master\/Gruntfile.js#L132\"><code>Gruntfile.js<\/code> @ line 132<\/a>\u00a0and add the build tasks:<br \/>\n&#8216;less:build&#8217;, &#8216;autoprefixer:build&#8217;Then jump down to <a href=\"https:\/\/github.com\/roots\/roots\/blob\/master\/Gruntfile.js#L139\">line 139<\/a>\u00a0and add <code>uglify<\/code> to the <code>js:tasks<\/code>.<br \/>\nThis is my final <code>watch<\/code> which I verified works:<\/p>\n<pre lang=\"bash\"><code>watch: {\n  less: {\n    files: [\n      'assets\/less\/*.less',\n      'assets\/less\/**\/*.less'\n    ],\n    tasks: ['less:dev', 'autoprefixer:dev', 'less:build', 'autoprefixer:build']\n  },\n  js: {\n    files: [\n      jsFileList,\n      '&lt;%= jshint.all %&gt;'\n    ],\n    tasks: ['jshint', 'concat', 'uglify']\n  }<\/code><\/pre>\n<\/li>\n<li>Btw, you can see how <code>WP_ENV<\/code> works, it&#8217;s very simple\u2013either it&#8217;s set to <code>development<\/code> or it defaults. Just check here: <a href=\"https:\/\/github.com\/roots\/roots\/blob\/master\/lib\/scripts.php#L22\">https:\/\/github.com\/roots\/roots\/blob\/master\/lib\/scripts.php#L22<span class=\"badge badge-notification clicks\" title=\"5 clicks\">5<\/span><\/a>.I also realized that Grunt&#8217;s default behavior is <em>not<\/em> to generate both minified and unminified assets as I previously stated, so it depends on the parameter you pass to <code>grunt<\/code>. <a href=\"https:\/\/github.com\/roots\/roots\/blob\/master\/Gruntfile.js#L158\">By default, it&#8217;s set to generate only unminified assets<span class=\"badge badge-notification clicks\" title=\"5 clicks\">5<\/span><\/a>:\n<pre><code>grunt.registerTask('default', [\n  'dev'\n]);<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/aside>\n<\/div>\n<div class=\"title\"><\/div>\n<ul>\n<li><strong>In addition to the above this is what I did:<\/strong><br \/>\nI had this issue with livereload where the current page would show the changes, but when opening a different page all the changes were gone (pages were loading the previous version of the main.css.<\/p>\n<aside class=\"quote\" data-topic=\"1952\" data-slug=\"how-to-correctly-add-bxslider-to-my-theme\" data-post=\"12\">\n<div class=\"title\"><\/div>\n<\/aside>\n<p><strong><br \/>\nUpdate: it seems that having livereload reload all the pages also works when leaving the WP_ENV constant intact, and only adding &#8216;version&#8217; to grunt watch tasks (not build).<br \/>\nOtherwise, try this:<\/strong><\/li>\n<li>To fix this, this is what I did:<strong><br \/>\n<\/strong>&#8211; Remove WP_ENV variable from wp-config.php<br \/>\n&#8211; Do the changes to grunt watch mentioned above<br \/>\n&#8211; Under livereload:<br \/>\nremove the main.css and scripts.css and replace with\u00a0main.min.css and scripts.min.js<br \/>\n&#8211; Add &#8216;version&#8217; \u00a0to watch-&gt;less&gt; tasks:<br \/>\ntasks: [&#8216;less:build&#8217;, &#8216;autoprefixer:build&#8217;, &#8216;version&#8217;]<\/li>\n<li>Source maps\u00a0<strong>This may need to be updated<\/strong><\/li>\n<\/ul>\n<\/div>\n<\/aside>\n<ul>\n<li>Using less source maps sounds like a good idea to. It makes it possible to see the original source lines for preprocessed css in the web inspector. See t<a href=\"http:\/\/roots.io\/using-less-source-maps\/\">his article<\/a> for an explanation on source maps in roots.<span style=\"line-height: 1.5;\">Note this rootpath will only work locally. Need to come up with a solution for this.<\/span><\/li>\n<li>\n<pre lang=\"js\">          sourceMap: true,\nsourceMapFilename: 'assets\/css\/main.min.css.map',\n          sourceMapRootpath: '\/PROJECTFOLDER\/content\/themes\/THEME_NAME\/'<\/pre>\n<p>&#8211; I also enable sourcemaps for js as follows. Not tested if it works yet<\/p>\n<pre lang=\"js\">        \n          options: {\n          \/\/ JS source map: to enable, uncomment the lines below and update sourceMappingURL based on your install\n          sourceMap: 'assets\/js\/scripts.min.js.map',\n          sourceMappingURL: '\/PROJECTFOLDER\/content\/themes\/THEME_NAME\/',\n         }<\/pre>\n<p>&#8211;<\/li>\n<li>Now activate the theme. Leave all options to yes <strong>except the one that changes the uploads folder.\u00a0<\/strong>I did this wrong and couldn&#8217;t reset it to the upload folder for skeleton.<\/li>\n<li>The home page should look like this:<a href=\"https:\/\/hesmid.nl\/test\/wp-content\/uploads\/2013\/09\/2013-09-16-15-14-43-e1379337479575.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-235\" src=\"https:\/\/hesmid.nl\/test\/wp-content\/uploads\/2013\/09\/2013-09-16-15-14-43-e1379337479575.png\" alt=\"Roots 101 Home page\" width=\"400\" height=\"182\" \/><\/a><\/li>\n<li>Test if you can upload an image. It should appear in the content\/uploads folder<\/li>\n<li>If everything works, merge the roots branch with master and push to remote\n<pre lang=\"bash\">git checkout master\ngit merge roots\ngit push<\/pre>\n<\/li>\n<\/ul>\n<h3>Roots Plugins:<\/h3>\n<p><strong>Note:<\/strong> Install order:<br \/>\n1. H5BP. After activation, refresh permalinks<br \/>\n2.\u00a0Rewrites<br \/>\n3. Soil<\/p>\n<p>&#8211; Since roots 7.0 some functionality are moved to <a href=\"http:\/\/roots.io\/plugins\/\">plugins<\/a>:<\/p>\n<p>&#8211; Install <a href=\"https:\/\/github.com\/roots\/soil\"><strong>Soil<\/strong> <\/a>to c<span style=\"color: #333333;\">lean up WordPress markup, use relative URLs, nicer search URLs, and disable trackbacks.<\/span><\/p>\n<p>Make sure theme_support for soil is enabled in config.php<\/p>\n<p><span style=\"color: #333333;\">Note: this also adds a bodyclass demo-page to a page that is called Demo Page -&gt; handy when referring to this page in main.js with demo_page<\/span><\/p>\n<p>&#8211;\u00a0<strong><a href=\"https:\/\/github.com\/roots\/roots-rewrites\">Roots rewrites<\/a><\/strong><\/p>\n<p style=\"color: #333333;\">Roots Rewrites enables clean URL rewrites for your WordPress plugins and theme assets folder.<\/p>\n<pre style=\"color: #333333;\"><code>\/wp-content\/themes\/themename\/assets\/css\/ to \/assets\/css\/\n\/wp-content\/themes\/themename\/assets\/js\/  to \/assets\/js\/\n\/wp-content\/themes\/themename\/assets\/img\/ to \/assets\/img\/\n\/wp-content\/plugins\/                     to \/plugins\/<\/code><\/pre>\n<p>Note: refresh permalinks settings after activating this plugin<\/p>\n<p><strong>Example of how links change with these two plugins:<\/strong><\/p>\n<ul>\n<li>No Soil, no rewrites:<br \/>\nhttp:\/\/localhost\/rootsfiddle\/content\/themes\/roots\/assets\/js\/scripts.js<\/li>\n<li>Soil:<br \/>\n<del>http:\/\/localhost<\/del>\/rootsfiddle\/content\/themes\/roots\/assets\/js\/scripts.js<\/li>\n<li>Rewrites + Soil<br \/>\n<del>http:\/\/localhost<\/del>\/rootsfiddle<del>\/content\/themes\/roots<\/del>\/assets\/js\/scripts.js<\/li>\n<\/ul>\n<p>&#8211; <strong><a href=\"https:\/\/github.com\/roots\/wp-h5bp-htaccess\">HTML5 Boilerplate&#8217;s .htaccess for WordPress<br \/>\n<\/a><\/strong>WordPress plugin that adds HTML5 Boilerplate&#8217;s .htaccess<\/p>\n<p>See also:\u00a0<a href=\"https:\/\/github.com\/h5bp\/server-configs-apache\">https:\/\/github.com\/h5bp\/server-configs-apache<\/a><\/p>\n<p>Note: \u00a0if htaccess does not change after activating the plugin, try deactivating the soil and or rewrite plugins temporarily.<\/p>\n<p>Note 2:\u00a0Anytime you update this file the .htaccess file in the root of your\u00a0WordPress install is automatically updated with the changes whenever\u00a0the permalinks are flushed or set \u00a0see lib\/htaccess.php)<\/p>\n<p>you need to ensure the you have the following Apache modules\u00a0<a style=\"color: #4183c4;\" href=\"https:\/\/github.com\/h5bp\/server-configs-apache\/wiki\/How-to-enable-Apache-modules\">enabled<\/a>:<\/p>\n<ul class=\"task-list\" style=\"color: #333333;\">\n<li><a style=\"color: #4183c4;\" href=\"http:\/\/httpd.apache.org\/docs\/current\/mod\/mod_autoindex.html\"><code>mod_autoindex.c<\/code>\u00a0(autoindex_module)<\/a><\/li>\n<li><a style=\"color: #4183c4;\" href=\"http:\/\/httpd.apache.org\/docs\/current\/mod\/mod_deflate.html\"><code>mod_deflate.c<\/code>\u00a0(deflate_module)<\/a><\/li>\n<li><a style=\"color: #4183c4;\" href=\"http:\/\/httpd.apache.org\/docs\/current\/mod\/mod_expires.html\"><code>mod_expires.c<\/code>\u00a0(expires_module)<\/a><\/li>\n<li><a style=\"color: #4183c4;\" href=\"http:\/\/httpd.apache.org\/docs\/current\/mod\/mod_filter.html\"><code>mod_filter.c<\/code>\u00a0(filter_module)<\/a><\/li>\n<li><a style=\"color: #4183c4;\" href=\"http:\/\/httpd.apache.org\/docs\/current\/mod\/mod_headers.html\"><code>mod_headers.c<\/code>\u00a0(headers_module)<\/a><\/li>\n<li><a style=\"color: #4183c4;\" href=\"http:\/\/httpd.apache.org\/docs\/current\/mod\/mod_include.html\"><code>mod_include.c<\/code>\u00a0(include_module)<\/a><\/li>\n<li><a style=\"color: #4183c4;\" href=\"http:\/\/httpd.apache.org\/docs\/current\/mod\/mod_mime.html\"><code>mod_mime.c<\/code>\u00a0(mime_module)<\/a><\/li>\n<li><a style=\"color: #4183c4;\" href=\"http:\/\/httpd.apache.org\/docs\/current\/mod\/mod_rewrite.html\"><code>mod_rewrite.c<\/code>\u00a0(rewrite_module)<\/a><\/li>\n<li><a style=\"color: #4183c4;\" href=\"http:\/\/httpd.apache.org\/docs\/current\/mod\/mod_setenvif.html\"><code>mod_setenvif.c<\/code>\u00a0(setenvif_module)<\/a><\/li>\n<\/ul>\n<p>Personal note: All the modules are installed on my webhost (if the mod_filter is not installed check if Apache &lt; 2.3.7, since filter was in the Core module then -&gt; in that case: remove\u00a0&lt;IfModule mod_filter.c&gt; from .htaccess.\u00a0WAMP local has a higher version of Apache ).<\/p>\n<p>In WAMP I had to enable: autoindex, filter, headers.<\/p>\n<h4>7. Set up repos and hooks on your staging and production server<\/h4>\n<p><strong>note:<\/strong> This might be a good moment to select the highest PHP version available on your shared server (webserver settings)<\/p>\n<p><strong>note 2:\u00a0<\/strong>If Git is \u00a0not installed on a shared host, try to install it using <a title=\"Install Git on a shared host\" href=\"https:\/\/hesmid.nl\/test\/web-development-2\/install-git-on-a-shared-host\/\">this<\/a> method<\/p>\n<p><strong>note 3:\u00a0<\/strong>On a cPanel host, add this to your .bashrc file to prevent the cPanel &#8216;SoftException writable by\u00a0group&#8217; error:<\/p>\n<pre>umask 022<\/pre>\n<p>Steps:<\/p>\n<ul>\n<li>See\u00a0<a title=\"Starting a new WP project with WP-Skeleton\" href=\"https:\/\/hesmid.nl\/test\/uncategorized\/starting-a-new-wp-project-step-by-step-method-2\/\">here<\/a>\u00a0(under &#8216;Server stuff&#8217;). don&#8217;t forget to create the .htacces file that blocks access to the .git repo<\/li>\n<li>add the staging server to your remotes:<\/li>\n<\/ul>\n<p>Create a bare repository outside the web directory, this is\u00a0<strong>Hub<\/strong>.cd<\/p>\n<pre lang=\"bash\">cd\nmkdir repos; cd repos \nmkdir site_hub.git; cd site_hub.git \ngit --bare init<\/pre>\n<p>Go to the working directory of your website (the\u00a0<strong>Prime<\/strong>):<\/p>\n<pre lang=\"bash\">cd ~\/www\ngit init \ntouch test.txt # extra step for empty dir: create a test.txt file (so there is something to commit)\ngit add . \ngit commit -m\"initial import of pre-existing web files\"<\/pre>\n<p>from inside Prime\u2019s \u00a0working directory, add Hub as a remote and push Prime\u2019s master branch:<\/p>\n<pre lang=\"bash\">cd ~\/www \ngit remote add hub ~\/site_hub.git \ngit remote show hub\ngit push hub master<\/pre>\n<p>create\u00a0<strong>post-commit<\/strong>\u00a0in the Prime repository (in .git\/hooks\/):<\/p>\n<pre lang=\"bash\">#!\/bin\/sh \n\necho \necho \"**** pushing changes to Hub [Prime's post-commit hook]\" \necho \n\ngit push hub<\/pre>\n<p>create\u00a0<strong>post-update<\/strong>\u00a0in the Hub repository (in hooks\/):<\/p>\n<pre lang=\"bash\">#!\/bin\/sh \necho \necho \"**** Pulling changes into Prime [Hub's post-update hook]\" \necho \n\ncd $HOME\/www || exit \nunset GIT_DIR \ngit pull hub master \n\nexec git-update-server-info\n\n<\/pre>\n<p>Give the right permissions to both the hooks:<\/p>\n<pre lang=\"bash\">chmod +x post-commit<\/pre>\n<p>LOCAL:<\/p>\n<pre lang=\"bash\">git remote add test remoteuser@remoteserver:repos\/myrepo_hub.git\ngit fetch test\ngit merge test\/master\nrm testfile.txt<\/pre>\n<p>Ignore .htaccess in gitignore<\/p>\n<pre lang=\"bash\">git commit -am 'message'\ngit push test master<\/pre>\n<p>On Server:<\/p>\n<ul>\n<li>For our setup with a staging and production sevim .htarver there also need to be created a file named . staging in the root directory of the staging server:\n<pre lang=\"bash\">touch .staging<\/pre>\n<\/li>\n<li>Deny acces to git repositories.\u00a0<strong>important!<\/strong><br \/>\nAdd the following to your top-level .htaccess file to forbid web access:<\/p>\n<pre lang=\"bash\"># deny access to the top-level git repository: \nRewriteEngine On \nRewriteRule \\.git - [F,L]<\/pre>\n<\/li>\n<li>(Also copy the other roots related rewrite rules to your remote htaccess)<\/li>\n<li>Update wordpress on the remote server\n<pre lang=\"bash\">\/*You may first need to initialize the submodule*\/\ncd www\ngit submodule init\ngit submodule update<\/pre>\n<\/li>\n<\/ul>\n<p>Note: The new version of wp-skeleton aparently uses an https link for the submodule. For this to work you need to install curl-devel on the server. The easier option is to use the git url instead (.gitmodules)<br \/>\n(You may also need to update the .git\/config if you already tried to initialize the submodule.)<\/p>\n<pre>[submodule \"wp\"]\npath = wp\nurl = git:\/\/github.com\/WordPress\/WordPress.git<\/pre>\n<ul>\n<li>\n<pre lang=\"bash\">cd wordpress\ngit fetch --tags\ngit tag #list all tags\ngit checkout 3.6.1<\/pre>\n<p>Replace 3.6.1 with the correct version number. Now commit the changes to your subrepository version to your main project:<\/p>\n<pre lang=\"bash\">cd ..\ngit commit -m \"Update WordPress to version 3.6.1\"<\/pre>\n<\/li>\n<li>Repeat the above steps for your production server<\/li>\n<\/ul>\n<h3>7b. Install WordPress and theme on the server<\/h3>\n<ul>\n<li>Create a database, install WordPress<\/li>\n<li>Change settings as before (tagline, Site address, timezone)<\/li>\n<li>Change permalinks. You will probably need to temporarily change the persmissions for htaccess: chmod 664 .htaccess it. Change it back to 644 afterwards<\/li>\n<li>Activate the theme on the server.<\/li>\n<li>Activate the roots addons:<br \/>\n&#8211; chmod 666 .htaccess<br \/>\n&#8211; Activate H5BP (For me, nothing was written to .htaccess. Not sure why. But after the next step it was)<br \/>\n&#8211; Activate Roots Rewrites<br \/>\n&#8211; Activate Soil<\/li>\n<li>Refresh the permalinks setting<br \/>\nActually the plugins behave rather weird. Try deactivating and activating until you have something like this:<\/p>\n<pre lang=\"bash\"># BEGIN WordPress\n\nRewriteEngine On\nRewriteBase \/\nRewriteRule ^index\\.php$ - [L]\nRewriteRule ^assets\/(.*) \/content\/themes\/roots\/assets\/$1 [QSA,L]\nRewriteRule ^plugins\/(.*) \/content\/plugins\/$1 [QSA,L]\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule . \/index.php [L]\n\n\n# END WordPress\n\n# BEGIN HTML5 Boilerplate\u00a0\n.....\n<\/pre>\n<\/li>\n<li>Don&#8217;t forget to chmod 644 .htaccess after you are done (or 664 if WP keeps nagging about unwritable htaccess<\/li>\n<\/ul>\n<h3>8. Essential Plugins<\/h3>\n<p>see\u00a0<a title=\"My WordPress Plugins\" href=\"https:\/\/hesmid.nl\/test\/web-development-2\/wordpress-web-development-2\/my-wordpress-plugins\/\">My WordPress Plugins<\/a><\/p>\n<h3>9. Updating WordPress<\/h3>\n<p>Change into the WordPress subrepository:<\/p>\n<pre lang=\"bash\">cd wordpress\ngit fetch --tags\ngit tag #list all tags\ngit checkout 3.6.1<\/pre>\n<p>Replace 3.6.1 with the correct version number. Now commit the changes to your subrepository version to your main project:<\/p>\n<pre lang=\"bash\">cd ..\ngit commit -m \"Update WordPress to version 3.6.1\"<\/pre>\n<p><strong>Important note:\u00a0<\/strong>pushing to your server will not update the submodules, so you will have to copy the new wordpress directory to your servers manually. Or my current method:<br \/>\n&#8211; push to server<br \/>\n&#8211; update the wp submodule on the server just the same way as you did on the local machine<\/p>\n<p>Note: after a wordpress update you may need to re-save the permalink settings<\/p>\n<h4>10. WordPress Security<\/h4>\n<p>source:\u00a0<a href=\"http:\/\/www.woothemes.com\/2013\/09\/improve-your-wordpress-security-with-these-10-tips\/\">http:\/\/www.woothemes.com\/2013\/09\/improve-your-wordpress-security-with-these-10-tips\/<\/a><\/p>\n<p><strong>Update regularly!<\/strong><\/p>\n<p><strong style=\"line-height: 1.5;\">Admin name:<br \/>\n<\/strong>&#8211; Create a user name different from admin. Also use a nickname different from user name.<br \/>\n&#8211; Optional: Create a fake admin account with subscriber role and very strong pwd<br \/>\n&#8211; Also hide the username of all users that can publish by changing their\u00a0<em>user_nicename\u00a0<\/em>in the database. See <a title=\"Hide Your WordPress Login from Author Archive\" href=\"http:\/\/itpixie.com\/2012\/10\/hide-your-wordpress-login-from-author-archive\/#.UmeahPmgkTU\">this<\/a> post<\/p>\n<p><strong>Limit login attempts<\/strong><\/p>\n<p>&#8211; with this plugin:\u00a0<a href=\"http:\/\/wordpress.org\/plugins\/limit-login-attempts\/\">http:\/\/wordpress.org\/plugins\/limit-login-attempts\/<br \/>\n&#8211;<\/a>\u00a0Note: not needed if you already use <a title=\"better-wp-security\" href=\"http:\/\/wordpress.org\/plugins\/better-wp-security\/ \">better_wp_security\u00a0<\/a><\/p>\n<p><strong>Disable file editing via the dashboard<br \/>\n<\/strong>&#8211;\u00a0if a hacker managed to gain access to your admin panel, they could also edit your files that way, and execute whatever code they wanted to.\u00a0So it\u2019s a good idea to disable this method of file editing, by adding the following to your\u00a0<strong>wp-config.php<\/strong>\u00a0file:<\/p>\n<pre>define( \u2018DISALLOW_FILE_EDIT\u2019, true );<\/pre>\n<p><b>Prevent base64 hacks<\/b><\/p>\n<p>Free themes can often contain things like\u00a0<a href=\"http:\/\/en.wikipedia.org\/wiki\/Base64\">base64 encoding<\/a>, which may be used to sneakily insert spam links into your site, or other malicious code that can cause all sorts of problems, as shown in\u00a0<a href=\"http:\/\/wpmu.org\/why-you-should-never-search-for-free-wordpress-themes-in-google-or-anywhere-else\/\">this experiment<\/a>, where 8 out of 10 sites reviewed offered free themes containing base64 code.<\/p>\n<p>&#8211; Note: this plugin may help?<br \/>\n<a href=\"http:\/\/wordpress.org\/plugins\/bulletproof-security\/\">http:\/\/wordpress.org\/plugins\/bulletproof-security\/<\/a><\/p>\n<p><strong>Keep a backup<\/strong><\/p>\n<p><strong>Use security Plugins<br \/>\n<\/strong>Here are a handful of popular options:<\/p>\n<ul>\n<li><a href=\"http:\/\/wordpress.org\/plugins\/better-wp-security\/\">http:\/\/wordpress.org\/plugins\/better-wp-security\/<\/a>\u00a0\u2013 offers a wide range of security features.<\/li>\n<li><a href=\"http:\/\/wordpress.org\/plugins\/bulletproof-security\/\">http:\/\/wordpress.org\/plugins\/bulletproof-security\/<\/a>\u00a0\u2013 protects your site via .htaccess.<\/li>\n<li><a href=\"http:\/\/wordpress.org\/plugins\/all-in-one-wp-security-and-firewall\/\">http:\/\/wordpress.org\/plugins\/all-in-one-wp-security-and-firewall\/<\/a>\u00a0\u2013 adds a firewall to your site.<\/li>\n<li><a href=\"http:\/\/wordpress.org\/plugins\/sucuri-scanner\/\">http:\/\/wordpress.org\/plugins\/sucuri-scanner\/<\/a>\u00a0\u2013 scans your site for malware etc.<\/li>\n<li><a href=\"http:\/\/wordpress.org\/plugins\/wordfence\/\">http:\/\/wordpress.org\/plugins\/wordfence\/<\/a>\u00a0\u2013 full-featured security plugin.<\/li>\n<li><a href=\"http:\/\/wordpress.org\/plugins\/websitedefender-wordpress-security\/\">http:\/\/wordpress.org\/plugins\/websitedefender-wordpress-security\/<\/a>\u00a0\u2013 comprehensive security tool.<\/li>\n<li><a href=\"http:\/\/wordpress.org\/plugins\/exploit-scanner\/\">http:\/\/wordpress.org\/plugins\/exploit-scanner\/<\/a>\u00a0\u2013 searches your database for any suspicious code.<\/li>\n<\/ul>\n<p><strong>More:<\/strong><br \/>\nTo learn more about hardening your website\u2019s security, please check out these two resources:<br \/>\n<a href=\"http:\/\/codex.wordpress.org\/Hardening_WordPress\">http:\/\/codex.wordpress.org\/Hardening_WordPress<br \/>\n<\/a><a href=\"http:\/\/wp.tutsplus.com\/tutorials\/11-quick-tips-securing-your-wordpress-site\">http:\/\/wp.tutsplus.com\/tutorials\/11-quick-tips-securing-your-wordpress-site<\/a><\/p>\n<h3>11. Roots Theme features and important files<\/h3>\n<p>There are some important files if you want to play around with the starter theme.\u00a0Check\u00a0<a href=\"http:\/\/roots.io\/roots-101\/\">here<\/a>\u00a0on the roots 101 website for more information.\u00a0\u00a0I left everything to the default settings for now<\/p>\n<ul>\n<li><code>lib\/config.php<\/code>\u00a0is used to enable\/disable theme features and set configuration values.<\/li>\n<li><code>functions.php<\/code>\u00a0is used to include files from the\u00a0<code>lib\/<\/code>\u00a0directory which contains all of the theme functionality. Don\u2019t place any custom code in this file \u2014 use it only for includes. You can place custom code in\u00a0<code>lib\/custom.php<\/code>.\u00a0 Since Roots is a starter theme, it\u2019s okay for you to modify files within\u00a0<code>lib\/<\/code>\u00a0to meet the needs of the site you\u2019re building.<\/li>\n<li><code>lib\/scripts.php<\/code>\u00a0is used to tell WordPress which CSS and JS files to enqueue. Any additional CSS or JS files should be added in here.<\/li>\n<li>\n<p id=\"root-relative-urls-and-rewrites\">Root Relative URLs &amp; Rewrites (These rules are added to your\u00a0<code>.htaccess<\/code>\u00a0file automatically).<\/p>\n<p>&#8211; With root relative URLs (<code>lib\/relative-urls.php<\/code>) your URLs will be output as\u00a0<code>\/assets\/css\/main.min.css<\/code>\u00a0instead of\u00a0<code><a title=\"Linkification: http:\/\/example.com\/assets\/css\/main.min.css\" href=\"http:\/\/example.com\/assets\/css\/main.min.css\">http:\/\/example.com\/assets\/css\/main.min.css<\/a><\/code>. Roots applies root relative URLs by hooking into WordPress filters on various functions, including navigation menu items and CSS\/JavaScript enqueued assets.\u00a0&#8211; The clean URL rewrites (<code>lib\/rewrites.php<\/code>) for static theme and plugin assets make your paths cleaner:\u00a0<code>\/wp-content\/themes\/themename\/assets\/css\/<\/code>\u00a0to\u00a0<code>\/assets\/css\/<\/code><\/li>\n<li><code>lib\/sidebar.php<\/code>\u00a0contains the\u00a0<code>Roots_Sidebar<\/code>\u00a0class which determines whether or not to display the sidebar based on an array of conditional tags or page templates.<\/li>\n<li><code>lib\/widgets.php<\/code>\u00a0is used to register sidebars and widgets.<\/li>\n<li>Roots includes an example vCard widget which can be removed or modified to create your own widget.<\/li>\n<li><code>lib\/nav.php<\/code>\u00a0contains functionality that cleans up the navigation menu markup.<\/li>\n<li><code>lib\/cleanup.php<\/code>\u00a0is mainly used to clean up the output of WordPress core markup.<\/li>\n<li>Theme Templates. The markup in Roots is based off\u00a0<a href=\"http:\/\/html5boilerplate.com\/\">HTML5 Boilerplate<\/a>\u00a0with ARIA roles for accessibility and the hNews microformat for posts.-\u00a0<code>base.php<\/code>\u00a0\u2014 The\u00a0<a href=\"http:\/\/roots.io\/an-introduction-to-the-roots-theme-wrapper\/\">theme wrapper<\/a>\u00a0which wraps the base markup around all template files the\u00a0<code>templates\/<\/code>\u00a0directory is where you\u2019ll be making most of your customizations<\/li>\n<li>Extending Templates:Even with the\u00a0<a href=\"http:\/\/roots.io\/an-introduction-to-the-roots-theme-wrapper\/\">theme wrapper<\/a>, the normal\u00a0<a href=\"http:\/\/codex.wordpress.org\/Template_Hierarchy\">WordPress Template Hierarchy<\/a>\u00a0is still in tact. The\u00a0<a href=\"http:\/\/roots.io\/an-introduction-to-the-roots-theme-wrapper\/\">Theme Wrapper Guide<\/a>\u00a0goes into depth about creating new\u00a0<code>base.php<\/code>\u00a0files<\/li>\n<li>Theme Assets (css, images, js): &#8211;\u00a0The assets directory contains all of your project\u2019s LESS, CSS, images, and JavaScript. LESS and JavaScript are concatenated and minified with the\u00a0<a href=\"http:\/\/roots.io\/using-grunt-for-wordpress-theme-development\/\">Grunt build script<\/a>.\u00a0<code>- less\/app.less<\/code>\u00a0contains all of your site styling and is compiled with\u00a0<code>less\/bootstrap\/bootstrap.less<\/code>\u00a0into\u00a0<code>css\/main.min.css<\/code>. &#8211;\u00a0JavaScript is compiled into\u00a0<code>scripts.min.js<\/code><\/li>\n<li>The CSS and JavaScript for your site are enqueued from\u00a0<code>lib\/scripts.php<\/code>. Every time you make changes to your LESS and JS, the files will be automatically cache busted as part of the\u00a0<a href=\"http:\/\/roots.io\/using-grunt-for-wordpress-theme-development\/\">Grunt build script<\/a>.<\/li>\n<\/ul>\n<h4>12. Optional: Remove or replace Bootstrap<\/h4>\n<ul>\n<li><strong>Note:<\/strong>\u00a0I&#8217;m interested in using sass with roots, but for simplicity I&#8217;ll stay with LESS for now.<\/li>\n<li>Remove Bootstrap (See Ben Word&#8217;s blog\u00a0<a href=\"http:\/\/benword.com\/using-roots-theme-without-bootstrap\/\">article<\/a>)Want to get the benefits of using Roots (theme wrapper, clean code, URL rewrites) without having to use Bootstrap?\u00a0Here\u2019s how to get up and running in just a few minutes:<br \/>\n&#8211;\u00a0<a href=\"http:\/\/www.rootstheme.com\/\">Download Roots<br \/>\n<\/a>&#8211; Edit\u00a0<code>lib\/scripts.php<\/code>\u00a0and remove the CSS enqueues for Bootstrap CSS<br \/>\n&#8211; Edit\u00a0<code>assets\/js\/plugins.js<\/code>\u00a0and remove the minified Bootstrap JS<br \/>\n&#8211; Remove\u00a0<code>add_theme_support('bootstrap-top-navbar')<\/code>\u00a0from\u00a0<code>lib\/config.php<\/code>\u00a0and the Bootstrap navbar specific modifications in the nav walker at\u00a0<code>lib\/nav.php<\/code>.Roots is delete key friendly, just like HTML5 Boilerplate.<\/li>\n<li>Alternative: use a Bootstrap SASS versionI haven&#8217;t done this yet, but the instructions in<a href=\"http:\/\/kalenjohnson.com\/customizing-roots-sass\/\">\u00a0this post<br \/>\n<\/a>will probably be helpful. You also may have to install\u00a0\u00a0bootstrap for sass and install compass for grunt<\/p>\n<pre>gem install bootstrap-sass\nnpm install grunt-contrib-compass<\/pre>\n<\/li>\n<li>Integrate Pure CSS with Roots<br \/>\nSee<a href=\"http:\/\/kalenjohnson.com\/customizing-roots-sass\/\">\u00a0this post\u00a0<\/a><\/li>\n<\/ul>\n<h4>13. Block unecessary Plugins during development<\/h4>\n<p>There are certain plugins that you don&#8217;t need to have active during development. Think about: Spam Destroyer, Sucuri Security, W3 Cash, Database backup plugins<\/p>\n<p>For this we can use Jaquith&#8217;s\u00a0<a href=\"https:\/\/gist.github.com\/markjaquith\/1044546\">plugin<\/a>\u00a0that disables plugins when you are on a local environment. Note that the working of this plugin depends on the constant WP_LOCAL_DEV, which is defined in the wp-config.php of the wp-skeleton<\/p>\n<p>To add this Gist (a static file), download it and put it in the\u00a0<strong>mu-plugins<\/strong>\u00a0folder<\/p>\n<p>Add and submit<\/p>\n<p>To test its working, log in to wordpress and install and activate a plugin to remove spam. Akismet and Spam destroyer for example. \u00a0Add and submit<\/p>\n<p>Now add the main files of these plugins to the end of Jaquith&#8217;s plugin:<\/p>\n<pre lang=\"php\">if ( defined( 'WP_LOCAL_DEV' ) &amp;&amp; WP_LOCAL_DEV ) {\n    new CWS_Disable_Plugins_When_Local_Dev( array( 'vaultpress.php',        'spam-destroyer\/index.php', 'akismet\/akismet.php') );<\/pre>\n<p>Check if the plugins are indeed deactivated (no need to log out)<\/p>\n<p>Because we switched to a different branch, we have to log out from WordPress first and then log in again to see the theme.\u00a0Do this.\u00a0<strong>Important:\u00a0<\/strong>&#8211; If you switch back to the master branch, then you have to log out and in again &#8211; If your new theme is activated, switching to the master branch and then logging in into your wordpress will produce several errors. Therefore it is best to keep working on the testing branch until it is finished and then merge it back into the master branch. \u00a0After that you can go ahead and activate the theme. Now assume we have done a lot of work on the theme: &#8211; Log out of wordpress &#8211; Checkout the master branch &#8211; Merge the testing branch<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Goals: &#8211; Keep a local WordPress \u00a0installation under version control (but ignore WordPress core files) &#8211; Use WP-Skeleton (wordpress core as submodule in separated folder, content and config files in root) &#8211; Use\u00a0the starter theme Roots 101 &#8211; Deploy to a staging and production server (depending on the current Git branch?) &#8211; Keep uploads out [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17,4],"tags":[27,19,3,33,5,14,22],"acf":[],"_links":{"self":[{"href":"https:\/\/hesmid.nl\/test\/wp-json\/wp\/v2\/posts\/230"}],"collection":[{"href":"https:\/\/hesmid.nl\/test\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hesmid.nl\/test\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hesmid.nl\/test\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hesmid.nl\/test\/wp-json\/wp\/v2\/comments?post=230"}],"version-history":[{"count":113,"href":"https:\/\/hesmid.nl\/test\/wp-json\/wp\/v2\/posts\/230\/revisions"}],"predecessor-version":[{"id":4738,"href":"https:\/\/hesmid.nl\/test\/wp-json\/wp\/v2\/posts\/230\/revisions\/4738"}],"wp:attachment":[{"href":"https:\/\/hesmid.nl\/test\/wp-json\/wp\/v2\/media?parent=230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hesmid.nl\/test\/wp-json\/wp\/v2\/categories?post=230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hesmid.nl\/test\/wp-json\/wp\/v2\/tags?post=230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}