-
Notifications
You must be signed in to change notification settings - Fork 6
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
Format CSS on push to master #88
Comments
Ideally, it'd be very nice to be able to format Eclipse CSS properties, eg. https://github.com/AObuchow/Eclipse-Spectrum-Theme/blob/master/com.aobuchow.themes.spectrum/css/preference_styles.css. Doing manual formating on these types of files is quite tedious. |
@ingomohr this might be something that interests you ;) |
Potentially (?) relevant: https://github.com/marketplace/actions/auto-minify |
@tabjy do you happen to have any preffered CSS formater tools? |
I often just use the preset comes with my editor/ide |
@tabjy me too ;) Thanks for the input !! |
What about format-on-save (i.e. right when the file is saved)? |
@ingomohr Ill have to look into whether wild web developer supports formatting CSS (as it’s provided by a language server). A github workflow would be nice however so that any contributors CSS additions could be auto formatted regardless of their editor/IDE. |
To clarify, I edit Spectrum Theme’s CSS with Eclipse’s Generic Editor, which is getting LSP support from the CSS LS provided by Eclipse Wild Web Developer |
Yes, it would be nice to have the contributors not worry about formatting. If you would set the format-on-save preference as project specific preference, the contributors would also not have to worry. |
These are 2 good points that I hadn't considered. I don't mind the formatting not being visible at the review stage, however, maybe a better solution than a GitHub workflow exists (as you proposed below).
I suppose you mean .project/Eclipse specific settings correct? This is a good idea :) For JS/TS, ESLint which requires a .eslintrc which is a editor-agnostic configuration file for linting rules. ESLint can be run through IDE's (eg. Eclipse + Wild Web Developer) or as a standalone application. Maybe there's some CSS formatter application that has a similar configuration setup? PR guidelines could mention to run the CSS formatter before submitting a PR. The more I think of this... the more I believe I'm overthinking it - your suggestion might be simplest :) (Provided that it's already supported in Wild Web Developer) |
All good points, you've made @AObuchow :). We'll see what works best, I think. |
So, Wild Web Developer does not have any CSS formatting abilities. I looked into microsoft/vscode-css-languageservice#44 and it seems that CSS formatting extensions are created in the VSCode world so that the LS doesn't have to handle it. Also related: microsoft/vscode#39088 It seems that running something like https://prettier.io/ as a save or build action might work best (or just something that contributors can run before pushing a PR). I could probably set up a package.json for the repo that contains prettier and a script to format. It does feel a bit weird to do this for a maven project, however... but I'm not really against trying it out, could be cool. |
Prettier supports pre-commit hooks: see option 6. Ideally, an eclipse plugin that integrates Prettier would be nice (however there’s some work involved). It would be useful for Wild Web Developer users however |
Part of #88 Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
Part of #88 Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
Part of #88 Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
So I added prettier to the master branch.
Mention of these formatting options should be put in the PR submission guidelines. I've also reformatted the entire project's CSS. Hopefully, I didn't break anything :D |
Part of #88 Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
It might be a bit redundant now that the project is using prettier, but this github workflow could be used to make sure all CSS used in valid when pushing to master: https://github.com/github/super-linter |
For now, formatting with prettier using the previously mentioned options is good enough so I’m going to close this. |
It'd be nice to have some automatic CSS formatting running with GitHub Actions when pushing to master.
I haven't looked much into the topic, but I found these CSS formatters that could be useful:
The text was updated successfully, but these errors were encountered: