-
Notifications
You must be signed in to change notification settings - Fork 18
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
Only support app.scss name ? #41
Comments
Hello @sblondeau ! I'm also new to this component but i managed to make other entries aside of Here is what i have :
h1 {
text-decoration: underline;
}
@import "components/_variables";
body {
background-color: $bodyBackgroundColor;
}
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('styles/global.scss') }}">
<link rel="stylesheet" href="{{ asset('styles/app.scss') }}">
{% endblock %}
{% block javascripts %}
{{ importmap() }}
{% endblock %}
</head>
<body>
<h1>
H1 being underlined
</h1>
{% block body %}{% endblock %}
</body>
</html>
symfonycasts_sass:
# Path to your Sass root file
root_sass:
- '%kernel.project_dir%/assets/styles/app.scss'
- '%kernel.project_dir%/assets/styles/global.scss'
# The Sass binary to use
binary: null
# Whether to embed the sourcemap in the compiled CSS. By default, enabled only when debug mode is on.
embed_sourcemap: '%kernel.debug%' You should be good after that. Now you can run : And it should be good on your development environment ! Additionnal notes :
The expected output has to be all your paths listed in apesl8@PORT253:~/Path/To/Your/Project$ php bin/console sass:build
^ array:2 [
0 => "/home/user/Path/To/Your/Project/assets/styles/app.scss"
1 => "/home/user/Path/To/Your/Project/assets/styles/global.scss"
] Hope this helps ! 🙏 |
Many thanks Thomas for your detailed answer. 🙏 |
@thomasmerlin That's a wonderful explanation. Would you mind adding a small section to the docs? It doesn't even need to be nearly this complete - the important parts are showing the Also:
This gave me the idea: when you run |
Hello @weaverryan ! Glad my comment helped somehow 🙏 For the documentation point, main purpose is to add a "How to have multiple CSS entries at once" section ? Is there any best practice to "promote" for that ? Like, having a global css file and then having another page-specific css file ? (I don't know if that's the best way to use the component, just wondering)
I agree. This would be more clear for the user on what's compiled, i'll give it a try on it this week 👍 |
Hello @weaverryan ! Following what we said yesterday, i was giving a look at the listing of sass files to be compiled when executing public function runBuild(bool $watch): Process
{
$binary = $this->createBinary();
$args = $this->getScssCssTargets();
$output = $this->output;
$output?->section('Sass files to be compiled');
$output?->listing(
array_map(
function ($target) use ($output) {
$targetExploded = explode(':', $target);
return end($targetExploded);
},
$args
)
);
if ($watch) {
$args[] = '--watch';
}
if ($this->embedSourcemap) {
$args[] = '--embed-source-map';
}
$process = $binary->createProcess($args);
if ($watch) {
$process->setTimeout(null);
$inputStream = new InputStream();
$process->setInput($inputStream);
}
$output?->note('Executing Sass (pass -v to see more details).');
if ($output?->isVerbose()) {
$output->writeln([
' Command:',
' '.$process->getCommandLine(),
]);
}
$process->start();
return $process;
} Here is an example output on the project i'm working on (both without and with What do you think of that ? 🙏 |
There is no way to make something like this using AssetMapper and this bundle? import './styles/list.scss' and then AssetMapper & SassBundle will know to compile |
Is important when you change the root_sass conf |
Hello,
I try this new amazing bundle, but maybe I miss something.
When I create e.g a home.scss, and add
<link rel="stylesheet" href="{{ asset('styles/home.scss') }}">
in my home.html.twig templateand then run
php bin/console sass:build --watch
I obtain this error message in CLI
Could not find Sass file: "/path/to/my/projetc/assets/styles/app.scss"
If I rename in app.scss it works. Is it impossible to use another file name ?
Thanks for your help
The text was updated successfully, but these errors were encountered: