Wow Chrish, many thanks for your quick answer!! I’ll try your new version and will report the test comments.
I would like aks a question in relation with sass (I’m not using it yet). Is it possible to pass variables from php (controller or view files) to the sass files using sass variables? In such a case could you give me a short example?
By the moment, I’m using style files like “mycss.php” with text/css header (you know, the old trick) with some php variables for colour and such things inside.
Off topic:
What kind of human being could even think in understand this regexp?:
So it’s not inserting the last “)” parenthesis due to the helper function already has some parenthesis im $image variable. I think it’s something related with parsing the regexp of helpers. (I have another helper function not using parenthesis and it works fine passing arrays).
In you application configuration (usually main.php in app.config) you need something like:
'components'=>array(
'assetManager'=>array(
'class'=>'common.extensions.phamlp.PBMAssetManager',
'parsers'=>array(
'scss'=>array(
'class'=>'common.extensions.phamlp.Sass',
'output'=>'css',
'options'=>array(
.... // other options - looking at extensions here
'extensions'=>array(
'compass'=>array(
// adjust the paths to suit and see Compass docs for all options
'project_path'=>realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'),
'images_path'=>realpath(dirname(__FILE__).'/../assets/images'),
'http_images_path'=>'/images/image/path',
'relative_assets'=>false // relative assets has a bug
)
)
)
),
)
),
.... // other components
);
great extension I try to figure out how to work with asset manager and @import in scss files. How do you manage many scss files? For example i would like to have one scss file per widget (And only one css file in production), but my experiments with main.scss and @import rules wasn’t successful.
Using Sass/Compass is just a matter of installing Ruby and the Compass gem and run ‘compass watch’ - the css output will automatically update when the source files (scss/sass) changes.
IMO, you should only use phamlp when there is no other option.
Extak: Your question is best answered elsewhere, like the Sass homepage, or by means of a Google search for Sass tutorials.
You need to make sure the load_paths directive is set up in the extension config - which is in assetManager[‘parsers’][‘sass’][‘options’] in the main config file.
This is a great extension, I’m currently using it to convert all of my views and styles to haml and sass.
One issue I’ve come across is that css files generated by this can get cached locally on individual users browsers. This is good as it speeds thing up a little, however we regularly release new code to production. This cacheing is causing a headache as users fail to receive the new versions. Is there anyway to add a version number/letter to the name of generated css files?