Search

(I'm not sure if anyone's even using Symphony No.5 apart from me but I thought I'd put this out there in case it's of use or interest to anyone.)

For those who haven't come across it before, Symphony No.5 is basically a mashup of Symphony with HTML5Boilerplate and a bunch of extras, currently things like Bootstrap, Less CSS, Coffeescript and a few other useful defaults, meant as a quick launch point for new Symphony projects. I've now made a companion tool to this, symphonyno5.sh which is a bash shell script that makes administering a Symphony No.5 project a whole bunch easier.

Btw, before continuing on with the commands, the three new headline features of Symphony No.5 v0.6.1 (which the shell script help handle automatically) are: -

  • New companion extension production_mode (my first ever Symphony extension - woot!) that adds a 'production-mode' parameter to the parameter pool allowing master.xsl to automatically serve up minified, production assets when enabled in Preferences
  • Dual manifest folders (development & production) - always do this anyway so why not automate it
  • Extensions installed as submodules via extensions.csv Thanks John Porter! (@designermonkey)

For more about Symphony No.5 the main project see the Docs which have just had a bunch of TLC given to them ;o)

Steal it! -- Btw, in case it proves useful to anyone, the shell script is released under UNLICENSE (aka public domain) so feel free to steal it, hack it, do whatever you want with it!

symphonyno5.sh Usage

Create a new project

symphonyno5 new projectname

Update/install Symphony Extensions from extensions.csv

symphonyno5 extensions

Compile Coffescript & Javascript into single, minified production file

symphonyno5 compile scripts

Compile Less CSS into single, compressed CSS file

symphonyno5 compile styles

Cleanup files etc post installation

symphonyno5 postinstall

Set directory & file permissions

symphonyno5 fixperms 0775 0664

Future Ideas

Would love anyone's thoughts or ideas on any of the following. Currently I'm pondering: -

  1. Maybe do away with Bootstrap, it's disabled by default already and including it adds quite a bit of bloat to the .git folder. I'm 80% decided to scrap it at this point, also with the new dedicated filelist for the script concatenator/minifier adding it after is now easier than once it was. Perhaps just add really clear/easy install instructions? Ideally I suppose would be a symphonyno5 add bootstrap command that would edit all the necessary files, but that seems tricky using bash to edit master.xsl and build.xml. Thoughts?

  2. I would love to figure out a way to generate compiled asset filenames with a hash based on the current git commit and then update the master.xsl template with that filename - in plainer words, when I git push to my live server I would like the master.xsl <script> element's src to point to e.g. /workspace/scripts/production-3f6d291c7e6b.min.js which is the latest output from the script compiler.

  3. Combine the new command with the postinstall command using y/n prompts to determine when users have run the http://yourdomain.com/install part of the process? Make it like an installation wizard? Benefits/problems with this approach?

  4. Similar to 1. perhaps move away from using Less CSS by default, the Symphony Way is to provide a clean slate from which to base our projects and perhaps Symphony No.5 is being way too opinionated, but on the other hand being opinionated is kinda what gives it its use. (The Coffeescript integration doesn't suffer from this problem as all one has to do to avoid using it is delete the main.coffee file and write one's Javascript directly to main.js, the build script will only compile .coffee files first if they're there.)

Ok, that is a decent effort you've put in there... but I'd like to point you to Phing which is a build tool written in PHP and can handle all those things for you from a single build.xml configuration.

Interesting stuff. Thanks for sharing, and I'll look at this and Phing in future.

New companion extension production_mode (my first ever Symphony extension - woot!)

Congrats! I was actually going to use this yesterday on a project, but it's in Symphony 2.2 so I used the $root parameter and matched against the domain name instead. Will definitely keep Production Mode in mind for new sites.

@petsagouris - thanks for the link, certainly looks very powerful, but I didn't want to add yet another dependency, in fact if you see below I've now removed the ant build script completely, switching everything over to bash and standard Unix tools e.g. grep, sed, awk etc - having battled with Ant I find working with the standard unix tools much better

@david - cheers! Yeah Production Mode is a blatant rip-off of Maintenance Mode but it made a great learning experience for a first extension, I now understand how a basic extension fits together etc - defintely encouraged me to try another one soon!

Updates

I've made a number of big changes over the previous version, the aim was to make the project a lot less opinionated, minimise external dependencies and take it back towards Symphony's philosophy of not including everything from the start. Have noted the changes below for those interested...

Pure bash and Unix - No more Ant dependency

The bash script is now the only command-line tool, removed the Ant build script and replaced it with all Unix-y goodness and an API call to Google Closure for the JS minification. Also compile now reads the javascripts list directly from master.xsl so the compilation procedure is now fully automated.

Automatically updates master.xsl with SHA1 hashed asset filenames

The compile command will now automatically append a trimmed SHA1 hash of the file to the production.min.ext files and updates master.xsl with that new filename - so when Production Mode is enabled the new minified assets are served up with zero risk of the old ones being cached. Simply compile and git push to your live server!

CSS PreProcessor Agnostic (Support for Less, Sass & Stylus)

compile now has support for all three major CSS PreProcessors, simply use main.scss, main.styl etc and compile will do its magic. Also removed all the default Less stuff from styles, the only thing remaining is the vanilla imports of CSS Reset, H5BP Print Styles and Font Awesome from vendor. (And since the @import statement is understood by all 3 preprocessors you can simply change any .less extensions to .scss or .styl and you're good to go)

new is now a guided, question based installer

Removed the postinstall command, merging everything into a single new command that asks a few questions, guides the user through and handles all the boring, repetitive stuff, finishing with a fresh single-commit git repository all ready to begin development (even in a develop branch)

Lightweight - Removed Bootstrap, default mixins/styles, 3rd party stuff

Got rid of Bootstrap and various other extra bloat - wanted to make it all much more lightweight and unopinionated, much more like normal Symphony but with the HTML5 stuff and compilation support.

Fix Permissions - Automaticaly detect and fix file permissions

fixperms now reads the correct permissions directly from manifest/config.php and will make sure those are applied correctly to your manifest and workspace directories. There's also a new command setperms that allows you to easily set the manifest and workspace dir & file permissions. The root directory, extensions, symphony and all other files/dirs are left alone (symphony and root are correctly set during a fresh installation via new)

See the github READMEs for more: -

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details