The Zurb Foundation web front end framework is excellent, with advanced workflow automation tools and features. Unfortunately, development on new versions is quick and sometimes content management system plugins based on this framework -- like the Drupal theme modules -- sometimes don't move at the same pace. Or maintenance stops on a widely adopted version in favor of a new version, while the previous version is still essential to web developers and site operators. This might require using Foundation 5 for some projects and Foundation 6 for others.
In my case I use the ZURB Foundation 5 theme with Drupal 7 for some projects and Foundation 6 with for other projects that don't require Drupal, with sass and the Foundation provided
gulpfile.babel.js for Foundation 5 and 6 respectively. Because of this requirement, I need both versions installed.
It should be noted that while I was able to get both versions working on both Manjaro and openSUSE (and on an overwritten installation of Ubuntu 17.04) -- I don't have any experience with Ruby or gems, or (even Node.js) which required two installations of the Foundation 5 gem, globally and in my user directory. Nevertheless, the installations work after some trial and error, and I wrote this article simply to provide a reference starting point for getting both versions co-installed, which is to make sure version 5 and version 6 executables are installed in different locations and create symlinks to these with different names for the same foundation command that is used by both versions.
The Zurb site indicates that this is not possible out-of-the-box. But with some modification of the default installations and symlinking, it is possible to install and use both versions on the same Linux installation.
Before installing either version of Zurb Foundation, install the dependencies. For Foundation 5, these are Git, NodeJS, and Ruby 1.9+. For Foundation 6, there don't seem to be any requirements besides NodeJS. NPM is also required to install development dependencies within the projects and to install Foundation 6.
In the Arch based Manjaro or openSUSE Tumbleweed git seems to be already installed by default -- unless it was installed as a dependency of something else I installed, as is an appropriate version of Ruby. But Node.js and NPM will need to be installed before installing either version of Foundation.
npm8is automatically selected for installation when
Install grunt-cli and bower
--no-user-installwill install everyting in the
/opt/gemdirectory, creating a subdirectory called
/opt/gem/gems. The foundation executable and the executable of a dependency will be created at
/opt/gem/bin/foundation. I wanted to install in
/opt, trying to follow UNIX traditions and standards so I had to use sudo. You may want to experiment and think about how you want to install using administrator privleges or not or using default settings, or the options I used. The decision may be different based on the distribution you use. The second installation of Foundation 5, above, using the
--user-installinstalls in the user's home directory at
~/.gemfollowing the heirarchy of
/opt/gems. The user's PATH environment variable should be modified to include the local installation.
/usr/bin/foundationto the actual Foundation 6 executable
/usr/lib/node_modules/foundation-cli/bin/foundation.jsThe symlink should be renamed to reflect the version.
/usr/local/bin/foundationto the actual Foundation 6 executable
/usr/local/lib/node_modules/foundation-cli/bin/foundation.jsThe symlink should be renamed to reflect the version.
[brook@VN7-592G-70EN-MANJARO:~] $ ls -l /usr/bin | grep foundation lrwxrwxrwx 1 root root 23 Jul 28 17:59 foundation5 -> /opt/gem/bin/foundation lrwxrwxrwx 1 root root 52 Jul 28 17:51 foundation6 -> ../lib/node_modules/foundation-cli/bin/foundation.js
N7-592G-70EN-openSUSE:~ # ls -l /usr/local/bin | grep foundation lrwxrwxrwx 1 root root 52 Nov 6 16:52 foundation6 -> ../lib/node_modules/foundation-cli/bin/foundation.js VN7-592G-70EN-openSUSE:~ # ls -l /usr/bin | grep foundation lrwxrwxrwx 1 root root 31 Nov 6 17:07 foundation5 -> /opt/gem/bin/foundation.ruby2.4 VN7-592G-70EN-openSUSE:~ #
The key to making both the Foundation 5 and Foundation 6 commands work is to make sure the executables for both of these versions are in different locations and, in the case of Foundation 5, symlink to the actual executable from /usr/bin using a name other than 'foundation' -- I chose 'foundation5'. In the case of Foudation 6, the command for which is itself a symlink to the actual executable created during installation, the link should be renamed to something other than 'foundation' -- I chose 'foundation6'.
npm suggests using Yarn instead of Bower as Bower is depricated.