
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
microservice_precompiler
Advanced tools
The microservice precompiler uses a handful of technologies to compile Javascripts and Stylesheets and create HTML pages from templates into a distribution folder ready for deployment. The so-called "microservices" used are CoffeeScript, SASS and Mustache, compiling and minifying (where possible) into Javascript, CSS and HTML, respectively.
The SASS (or SCSS) is compiled into CSS via Compass; the CoffeeScript is translated to Javascript via Sprockets; both CSS and JS have their dependency trees included in-file by Sprockets; CSS and JS are then minified and compressed via YUICompressor and Uglifier, respectively.
The gem requires that your project root be a Compass project and expects that you have a folder structure matching the following in the root of your project:
javascripts/
sass/
templates/
mustaches.yml
Where javascripts/ contains your Coffee, sass/ contains your SASS, and templates contains a folder structure matching your mustaches.yml file for building out pages from mustache templates (see below).
To use with bundler add this to your Gemfile:
gem 'microservice_precompiler'
Or install it yourself:
$ gem install microservice_precompiler
To build all assets and templates into the distribution (./dist by default) folder:
require 'microservice_precompiler'
precompiler = MicroservicePrecompiler::Builder.new
precompiler.compile
Or with initialize options:
require 'microservice_precompiler'
precompiler = MicroservicePrecompiler::Builder.new
precompiler.project_root = "."
precompiler.build_path = "dist"
precompiler.mustaches_filename = "mustaches.yml"
precompiler.compile
This runs all the precompiling options. Each can also be invoked individually:
# Clears the dist folder and sass cache files
precompiler.cleanup
# Runs the Compass build, which sends SASS to cachs
precompiler.compass_build
# Runs the Sprockets build which compiles CoffeeScript, minifies assets and moves to dist folder
precompiler.sprockets_build
# Runs the Mustache template build, which creates output files with the same syntax from the mustaches config yaml
precompiler.mustache_build
These two parts are pretty simple. They are contained within their relevant directories and are written in their respective technologies. Because Sprockets is used to compile them the folders may contain subfolders which are automatically included in-line if the following line is present in a top-level file (where dependencies is the name of the subfolder you wish to include):
/*
*=require_tree ./dependencies
*/
The mustache builder requires you to provide a template file and a logic file from which to build the template. You can create a complex folder structure in the templates directory as long as it's logic is matched in the mustaches.yml config file. An example of the mustaches.yml follows:
templates:
- Sample:
- Sample
- Sample1
- SampleFolder:
- Sample2:
- Sample2
- SampleFolder:
- Sample2
- sample_with_underscore
git checkout -b my-new-feature
)git commit -am 'Added some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that microservice_precompiler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.