This week, I have been looking at Sage Roots 8.5.1 to install on my server. I would like to get into some more modern workflow and hopefully save some time in the long run while developing websites.
Sage has a big update coming and they plan on using Yarm, Boostrap 4 and more.
Therefore, the install is a litle bit different for the latest version of Sage. Don’t mix them up. I decided to go for the latest stable build but was pulling in the build from Github, obviously this won’t work as the stable build still uses Gulp and Bower. I have used these in the past and still remember it quite well so it wasn’t too hard to setup. Basically, I followed the Theme installation instructions here.
Connect to your Server and run the following command in your themes folder
Serverpilot Composer is a little bit different, so instead of “Composer” you have to use: “composer7.1-sp” as shown below.
# @ example.com/site/web/app/themes/ $ composer7.1-sp create-project roots/sage your-theme-name 8.5.1
Install NodeJS, NPM, Bower and SASS on Ubuntu
Next I installed all of the above using the following commands:
$ sudo apt-get update $ sudo apt-get install nodejs
In this case, we also need to install npm, which is the Node.js package manager. You can do this by typing:
$ sudo apt-get install npm
Lastly, we still need Bower and SASS. We can use:
$ sudo bower install $ sudo npm install node-sass
I got an error when I was trying to install SASS, if you do get an error then check if everything has been installed okay with:
$ nodejs --version $ npm --version
If you see that everything is installed and well then you might have to create manually a symlink /usr/bin/node. Shortcut for bash compatible shells:
$ sudo ln -s `which nodejs` /usr/bin/node
Or if you use non-standard shells, just hardcode the path you find with which nodejs:
$ sudo ln -s /usr/bin/nodejs /usr/bin/node
Now you can run the commands to kickstart your Sage project, navigate to your theme directory and run these two commands:
$ npm install $ bower install
For more info on which commands you can run just check out the Sage Tutorial for version 8.5.1.
Small Github Workflow
This is more of a reminder for myself so that I remember what to do next. I started to work with Github with an external development server. I decided not to use a local one because I’m always connected to the web and my backups always run in the cloud.
First off I authenticated my development server with Github using this guide.
Then I pushed my projects to Github using the following (also borrowed from github guide).
git init # Add the files in your new local repository. This stages them for the first commit. git add . # Adds the files in the local repository and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'. Commit the files that you've staged in your local repository. git commit -m "First commit" # Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again. Copy remote repository URL fieldAt the top of your GitHub repository's Quick Setup page, click to copy the remote repository URL. In Terminal, add the URL for the remote repository where your local repository will be pushed. git remote add origin remote repository URL # Sets the new remote git remote -v # Verifies the new remote URL Push the changes in your local repository to GitHub. git push origin master # Pushes the changes in your local repository up to the remote repository you specified as the origin
After this, everything was working for me! Now I’m off to install the setup with Bedrock, so more coming soon!