Skip to content
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
12 changes: 12 additions & 0 deletions Classes/Parser/ScssParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace KayStrobach\DyncssScss\Parser;

use KayStrobach\Dyncss\Utilities\ApplicationContext;

class ScssParser extends \KayStrobach\Dyncss\Parser\AbstractParser
{
public function __construct()
Expand Down Expand Up @@ -45,6 +47,16 @@ protected function _compileFile($inputFilename, $preparedFilename, $outputFilena
try {
$this->parser->setVariables($this->overrides);
$this->parser->setImportPaths(array(dirname($inputFilename), dirname($preparedFilename)));
if (ApplicationContext::isDevelopmentModeActive() || $this->config['enableDebugMode'] === '1') {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

from my POV i would rather say, dev context AND enableDebugMode, would also change the less parser accordingly - respecting the context feels more natural here.
https://github.com/kaystrobach/TYPO3.dyncss_less/blob/master/Classes/Parser/LessParser.php#L104

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

whats your opinion?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

nope, please not. ;)

There are times when you need to debug "ad hoc", and I hate it when I have to login to the BE in order to adapt a setting. As EM config is serialized array it's really tough to change from CLI (Not sure wether typo3_console supports it?).

Also it is really tough to keep ext_conf_template.txt settings different per environment, when you have everything in SCM and have deployments with adapted settings (.env, HostConfiguration) per site/installation.

So I am in big favor of having a simple mechanism to toggle this feature, without EM settings ;)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

ok, then i would opt for deprecating the debugMode and simply switch to contexts ...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

What's wrong with having two different options?

In general TYPO3 Context will take care of properly enabling/disabling the feature

If you want to use sourcemaps, but for some reason(production?) don't want to set development context, well then enableDebugMode.

I don't see the cost involved of keeping enableDebugMode while prefering Context.

$this->parser->setSourceMap(\Leafo\ScssPhp\Compiler::SOURCE_MAP_FILE);
$this->parser->setSourceMapOptions(array(
'sourceMapWriteTo' => $preparedFilename . ".map",
'sourceMapURL' => '/' . str_replace(PATH_site, '', $preparedFilename) . ".map",
'sourceMapFilename' => '/' . $preparedFilename, // url location of .css file
'sourceMapBasepath' => PATH_site, // difference between file & url locations, removed from ALL source files in .map
'sourceRoot' => '/',
));
}
return $this->parser->compile('@import "' . basename($preparedFilename) . '"');
} catch (Exception $e) {
return $e;
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ Dyncss adapter for scss (not sass!)
Please see https://github.com/kaystrobach/TYPO3.dyncss for more documentation.

This extension just provides the adapter for the scss file format.

Generation of css sourcemaps is enabled for any TYPO3 Development context or by enabling debugMode in extension configuration of EXT:dyncss