Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Sass 3.4 and SilverStripe 3.2/3.3 #19

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions code/Compass.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
class Compass extends Controller
{

/**
* @var array
*/
private static $allowed_actions = array(
'convert',
'rebuild'
);

/**
* @var array
*/
Expand All @@ -29,7 +37,7 @@ class Compass extends Controller
/**
* @var float Which version of sass should we use.
*/
public static $sass_version = '3';
public static $sass_version = 'latest';

/**
* @var string - preferred syntax to use.
Expand All @@ -46,6 +54,9 @@ class Compass extends Controller
'3' => array(
'yard' => '', 'maruku' => '', 'sass' => '~>3.2', 'compass' => '~> 0.12.2', 'compass-colors' => ''
),
'3.4' => array(
'yard' => '', 'maruku' => '', 'sass' => '~>3.4', 'compass' => '~>1.0', 'compass-colors' => ''
),
'latest' => array(
'yard' => '', 'maruku' => '', 'sass' => '', 'compass' => '', 'compass-colors' => ''
)
Expand Down Expand Up @@ -290,15 +301,15 @@ public function rebuild($verbose = false)
$this->rebuildDirectory($dir);
} else {
if ($verbose) {
echo "\nRebuilding all\n";
echo "\nRebuilding all<br>\n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add these HTML tags is probably a bad idea and scope creep of this PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I also thought this is a bad idea. But if you rebuild in browser by dev/compass/rebuild you get all the messages in one line
I'll take it out and that "module skipping" below und make a new Pull.

}

foreach ($this->getAllThemes() as $theme) {
$dir = THEMES_PATH . DIRECTORY_SEPARATOR . $theme;

if (file_exists($dir . DIRECTORY_SEPARATOR . 'config.rb')) {
if ($verbose) {
echo "\nRebuilding theme: $theme\n";
echo "\nRebuilding theme: $theme<br>\n";
}
$this->rebuildDirectory($dir);
}
Expand All @@ -310,9 +321,20 @@ public function rebuild($verbose = false)
continue;
}

// Skip other modules
if ($name == 'framework') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why skip these core modules? If you're contributing to those modules you'd want them recompiled.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why, but framework's Sass threw some compiling errors, so I thought, you need some more Compass plugins or external mixins to compile. However, I've tested this now without skipping core modules – no compile errors :)

continue;
}
if ($name == 'cms') {
continue;
}
if ($name == 'admin') {
continue;
}

if (file_exists($path . DIRECTORY_SEPARATOR . 'config.rb')) {
if ($verbose) {
echo "\nRebuilding module: $name\n";
echo "\nRebuilding module: $name<br>\n";
}
$this->rebuildDirectory($path);
}
Expand Down
6 changes: 6 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ either your `_ss_environment.php` or `_config.php`.

For the module to install the gems you need to ensure that path is writable by the webserver

## Sass version (optional)

Define required Sass version (2, 3, 3.4, latest) to install in `mysite/_config.php`, e.g.:

Compass::$sass_version = '3.4';

## Installing the gems manually

When the webserver cannot write to your `SS_GEM_PATH` you may need to install this manually. In a terminal run the
Expand Down