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

Handle Sass cli options (style, --no-source_map, --embed-sources...) #39

Merged
merged 13 commits into from
Dec 21, 2023

Conversation

smnandre
Copy link
Contributor

@smnandre smnandre commented Nov 23, 2023

Update:

the following options are handled

// Input and Output
'--style' => 'expanded',                // Output style.  [expanded (default), compressed]
'--[no-]charset' => null,               // Emit a @charset or BOM for CSS with non-ASCII characters.
'--[no-]error-css' => null,             // Emit a CSS file when an error occurs.
// Source Maps
'--[no-]source-map' => true,            // Whether to generate source maps. (defaults to on)
'--[no-]embed-sources' => null,         // Embed source file contents in source maps.
'--[no-]embed-source-map' => null,      // Embed source map contents in CSS.
// Warnings
'--[no-]quiet' => null,                 // Don't print warnings.
'--[no-]quiet-deps' => null,            // Don't print deprecation warnings for dependencies.
// Other
'--[no-]stop-on-error' => null,         // Don't compile more files once an error is encountered.
'--[no-]trace' => null,                 // Print full Dart stack traces for exceptions.

Been playing with this bundle a bit so ... .. is this as you imagined it ?

I just took some options to start the work:

charset
style
source_map
embed_source_map
embed_sources

We can implement more after: https://sass-lang.com/documentation/cli/dart-sass/#no-source-map

I tried something else at first, so maybe the DTO is not really usefull

Tell me :)

src/SassBuilder.php Outdated Show resolved Hide resolved
src/SassOptions.php Outdated Show resolved Hide resolved
src/SassBuilder.php Outdated Show resolved Hide resolved
src/DependencyInjection/SymfonycastsSassExtension.php Outdated Show resolved Hide resolved
src/DependencyInjection/SymfonycastsSassExtension.php Outdated Show resolved Hide resolved
src/DependencyInjection/SymfonycastsSassExtension.php Outdated Show resolved Hide resolved
tests/SassBuilderTest.php Outdated Show resolved Hide resolved
@smnandre smnandre changed the title Handle Sass cli options (wip) Handle Sass cli options (style, --no-source_map, --embed-sources...) Nov 25, 2023
@smnandre
Copy link
Contributor Author

I reworked that and followed @stof feedback

Open to any comment / suggestions :)

src/DependencyInjection/SymfonycastsSassExtension.php Outdated Show resolved Hide resolved
src/SassBuilder.php Outdated Show resolved Hide resolved
src/SassBuilder.php Outdated Show resolved Hide resolved
src/SassBuilder.php Show resolved Hide resolved
src/SassBuilder.php Outdated Show resolved Hide resolved
@smnandre
Copy link
Contributor Author

How would you like to advance on this topic ?

bocharsky-bw
bocharsky-bw previously approved these changes Dec 15, 2023
Copy link
Member

@bocharsky-bw bocharsky-bw left a comment

Choose a reason for hiding this comment

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

Sorry for the delay!

Yeah, it seems like this one is ready for me, I don't have much to add, though hoped to hear some other opinions on it

src/SassBuilder.php Show resolved Hide resolved
@smnandre
Copy link
Contributor Author

I'm reworking this PR (just a bit) to make the options more obvious for everyone, maybe tonight, tomorrow elsewhen.

@smnandre
Copy link
Contributor Author

So, i reworked how the options are handled in what i personnaly find is more simple to handle.

  1. I removed the default values from the dependency injection / configuration
  2. The management of the [no] is internal in the Builder and - i find - more easy to manage / understand.

The 2 option format (php in snake case, CLI in --[no-]dashed) are mapped in the builder

I'd just need some help to add some of the missing tests (deps, errors, ...) .. or if you can wait a bit, i will have time in a couple of days.

@bocharsky-bw
Copy link
Member

Thanks! No rush at all, we can definitely wait 👍

@smnandre
Copy link
Contributor Author

That feels OK for me.. open to any feedback!

And if anyone wants to check on its side please do, i don't have any big sass project on my radar right now to fully test "live"

bocharsky-bw
bocharsky-bw previously approved these changes Dec 20, 2023
Copy link
Member

@bocharsky-bw bocharsky-bw left a comment

Choose a reason for hiding this comment

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

Hey Simon!

Thank you for rewriting it! It seems more solid now, so I think it's ready 👍

src/SassBuilder.php Show resolved Hide resolved
@smnandre
Copy link
Contributor Author

I have no idea how you'd imagine the documentation so feel free to tell me if what i added is not in the spirit of this Bundle :)

doc/index.rst Outdated Show resolved Hide resolved
doc/index.rst Outdated Show resolved Hide resolved
src/SassBuilder.php Show resolved Hide resolved
@bocharsky-bw
Copy link
Member

About the docs - list all the possible options is just fine for me

smnandre and others added 2 commits December 21, 2023 14:02
Co-authored-by: Victor Bocharsky <[email protected]>
Co-authored-by: Victor Bocharsky <[email protected]>
@smnandre
Copy link
Contributor Author

Hmm something has no worked / i messed my push ...

--watch should be the option and "true" the value

@smnandre
Copy link
Contributor Author

It is

...$this->getBuildOptions(['--watch' => $watch]),

I'm not sure if something happened with the git log (possible as i have this bad habit to destroy git histories on a daily basis 🤒 )

or maybe github did not show you the "flatten" changes ?

Copy link
Member

@bocharsky-bw bocharsky-bw left a comment

Choose a reason for hiding this comment

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

Ah, it might be so that I just missed it... or reviewed not full change set. Makes sense to me now! 👍

OK, I think we're completely ready here, thank you for your work on it!

@smnandre
Copy link
Contributor Author

It's been a pleasure... 😄

But don't thank me too soon, we'll see how many complaints/bugs you'll receive haha

@bocharsky-bw
Copy link
Member

Well, I'm glad you're somewhere around... 😅

@bocharsky-bw bocharsky-bw merged commit 5b831bf into SymfonyCasts:main Dec 21, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants