2017 © Pedro Peláez
 

silverstripe-module meta-languages

Allows you to add CoffeeScript, SCSS, and LESS as standard requirements and automatically compiles on page load.

image

silverstripe/meta-languages

Allows you to add CoffeeScript, SCSS, and LESS as standard requirements and automatically compiles on page load.

  • Wednesday, August 20, 2014
  • by unclecheese
  • Repository
  • 3 Watchers
  • 19 Stars
  • 444 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 6 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Meta-Languages for SilverStripe

This module allows the direct inclusion of uncompiled meta-language dependencies such as CoffeeScript, LESS, and SASS into your project and compiles them at runtime., (*1)

Basic Usage

Just require the dependency in your controller, and use it just like Requirements., (*2)

<?php
MetaLanguages::require_scss('themes/my-theme/css/sass/my-sass.scss');
MetaLanguages::require_coffeescript('mysite/javascript/coffee/my-coffee.coffee');

Limiting the compiling

By default, files are only compiled in "test" and "dev" environments. To limit compiling to specific environments:, (*3)

<?php
MetaLanguages::set_compile_environments(array(
  'dev',
  'localhost:8888',
  'staging.example.com'
));

Specifying target directories

By default, CoffeeScript compiles to project-dir/javascript, and SASS/LESS compiles to themes/my-theme/css, but those paths can be overridden., (*4)

Requirement_coffeescript:
  compiled_path: mysite/coffee
Requirement_scss:
  compiled_path: mysite/sass

Specifying a path to the "coffee" executable

The /usr/local/bin path is forced into the shell environment by default, but if you need more control over it:, (*5)

Requirement_coffeescript:
  coffee_exec: /my/path/to/coffee

Change the modification time tolerance that triggers a compile.

Compiling doesn't happen unless the "last edited" time difference between the raw and uncompiled file is greater than a specific number of seconds (defaults to 5), (*6)

MetaLanguages:
  modification_tolerance: 10;

To-do

Compiling SASS is exceedingly difficult from within PHP because it is a Ruby gem, so environmental issues are numerous. This module uses a thirdparty PHP compiler for SASS, which is known to have some bugs., (*7)

The Versions

20/08 2014

dev-master

9999999-dev

Allows you to add CoffeeScript, SCSS, and LESS as standard requirements and automatically compiles on page load.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe less sass scss coffeescript preprocessor meta-languages