Command Line Tool for Symphony No.5
This is an open discussion with 3 replies, filed under General.
Search
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.
(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: -
master.xsl
to automatically serve up minified, production assets when enabled in Preferencesextensions.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
Update/install Symphony Extensions from
extensions.csv
Compile Coffescript & Javascript into single, minified production file
Compile Less CSS into single, compressed CSS file
Cleanup files etc post installation
Set directory & file permissions
Future Ideas
Would love anyone's thoughts or ideas on any of the following. Currently I'm pondering: -
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 editmaster.xsl
andbuild.xml
. Thoughts?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 Igit push
to my live server I would like themaster.xsl
<script>
element'ssrc
to point to e.g./workspace/scripts/production-3f6d291c7e6b.min.js
which is the latest output from the script compiler.Combine the
new
command with thepostinstall
command using y/n prompts to determine when users have run thehttp://yourdomain.com/install
part of the process? Make it like an installation wizard? Benefits/problems with this approach?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 tomain.js
, the build script will only compile.coffee
files first if they're there.)