Yesterdayโs Sass CSS Stylesheet Primer Tutorial showed a really promising procedural CSS stylesheet creator tool โฆ
sass --watch [inputSassSCSS] [outputCSS]
โฆ in action, but the mode of that procedural application of that โฆ
- sass โwatch [inputSassSCSS] [outputCSS] # in a Mac OS X (or macOS) terminal window command line โฆ held up the further use of that window, because it is a foreground process โฆ and so jarred with us โฆ but todayโs work, good for Linux and/or Mac OS X (or macOS) โฆ and which you can see in action with todayโs PDF
slideshow โฆ allows for โฆ
- Linux or Mac OS X (or macOS) โฆ
- sass โwatch [inputSassSCSS] [outputCSS] & # in a Mac OS X (or macOS) terminal window command line run as a background process that remains even after logout, which is mostly all you need, except that โsass โwatchโ process can fallover โฆ so โฆ
- crontab controlled Sass โwatchdogโ (remember Linux Watchdog Primer Tutorial) โฆ that checks on whether Sass โwatchdogโ is running, and whether a (CSS stylesheet) file set check instance execution is running โฆ
#!/bin/ksh
# supervise_sass.ksh
# RJM Programming
# Make sure "sass --watch base.scss build/test.css" is running
if [ -z "`ps -ef | grep -v 'grep' | grep -c 'supervise_sass.ksh' | sed '/10/s//21/g' | sed '/1/s///g' | sed '/0/s///g'`" ]; then
while [ 0 -lt 1 ]; do
if [ -z "`ps -ef | grep -c 'build/test.css' | sed '/10/s//21/g' | sed '/1/s///g' | sed '/0/s///g'`" ]; then
/usr/local/Cellar/sass/1.22.12/bin/sass --watch /Applications/MAMP/htdocs/sass/base.scss /Applications/MAMP/htdocs/sass/build/test.css >> /Applications/MAMP/htdocs/sass/sass_watch.ok 2>> /Applications/MAMP/htdocs/sass/sass_watch.notok &
fi
sleep 10
done
fi
exit
โฆ (a Sass โwatchdogโ) called supervise_sassksh โฆ via โฆ crontab -l โฆ
* * * * * ksh -c "/Applications/MAMP/htdocs/supervise_sass.ksh >> /Applications/MAMP/htdocs/ss.xxx 2>> /Applications/MAMP/htdocs/ss.notxxx"
โฆ and note how what โsassโ represents (in commands) needed to be written in โlonghand path termsโ in crontab land, because you should not assume anything about the environment associated with crontab
โฆ which is good now โfor leave it (ie. Sass CSS Stylesheet preprocessing) to look after itself, and resurrect itselfโ. But tomorrow we want more genericity regarding โฆ
- more Windows friendly aspects to โwatchdogโ talk
- allow for multiple (CSS stylesheet) file set arrangements โฆ but also (a more thorough โwatchdogโ should) โฆ
- allow for a โcomplete shutdown, and not resurrectโ mode of use
Previous relevant Sass CSS Stylesheet Primer Tutorial is shown below.
When compartmentalizing web design work, and youโve already done a compartmentalization to โฆ
- backend โ (ie. โthe dataโ, โthe configurationโ) โฆ and โฆ
- frontend โ (ie. โthe lookโ, โthe functionalityโ)
โฆ a very natural, and intuitive way to divvy up some of the tasks for โfrontendโ above, a programmer or developer or team could work on โฆ
CSS styling
โฆ both in a โฆ
- project wide CSS styling sense โฆ and into โฆ
- nuances for exceptional webpages, perhaps
โฆ and it is here that we think todayโs (โHello Worldโ-ish) trial of the Sass (โSyntactically Awesome Style Sheetsโ) command line product should be of interest for you.
Letโs list in broad brush terms what Sass is capable of as far as CSS styling goes, and which we show you a stream of consciousness view of with todayโs PDFslideshow presentation (showing you an install on a MacBook Pro, and showing its features, and the mock up of a Sass *.scss file along with its imagined โsass โwatchโ manipulation to change the look of a mockup webpage) โฆ
- ability to preprocess, facilitating that compartmentalization thought above, command line โsass โwatchโ option can have a developer working on CSS stylesheet files (separately to other developers working on HTML (or server developers on PHP), separately to other developers working on Javascript) that are not the live CSS files, one step removed via โsassโ looking out for changes and automatically building the live CSS files when Sass *.scss files are saved โฆ as well as syntax and cross-browser thoughts such as โฆ
- ability to include snippets (โpartialsโ) or import from other Sass *.scss stylesheet files
- ability to have Sass variables
- ability to handle Sass nesting syntax
- ability to include Sass mixins to help with those cross-browser prefix (eg. โ-webkit-โ, โ-ms-โ) directive complications
- ability to share Sass (CSS) properties from one selector to another (โextend/inheritโ)
- ability to do mathematics via Sass โoperatorsโ helping convert hard-coded dimensions in pixels (px) to percentage (%) values better for responsive design principles
We hope you try out this wonderful software tool for yourself.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.