Any way to stop Prettier 2.8 from forcing all classes onto a single line? - tailwind-css

I'm using Prettier 2.8 in a Vite project with Tailwind and the Prettier-Tailwind plugin. My .prettierrc is just this:
{
"plugins": ["prettier-plugin-tailwindcss"],
"singleAttributePerLine": false,
"printWidth": 80
}
It's doing everything I want it to, except that it's forcing all the classes onto one line, even if they go past the printWidth. I don't want it to put them one-per-line like it used to, but even if I go add my own line breaks in, it removes them. Is there anything I can tweak in the .prettierrc to stop this? Thanks in advance.

Related

STOP auto adding space after colon on css properties

Yes, I know, according to someone's criteria this is more readable.
In our case it is NOT and we have programmed like this for years and we do not want to change it.
How can I disable that when I add a CSS property with auto-completion, it puts a space after the colon?
If I write, for example "flo", and I press enter to fill the "float" property, visual will put "float: ;" and I want it to write "float:;".
I have to remove space every single time and it's really struggling.
Thank you.
Search, configuration etc... NOTHING WORKS
You should be able to do what you want. You are looking for an emmet preference. See Emmet Preferences: v1.16 Release Notes:
There is supposedly support for the css.valueSeparator, see also GH Issue: Emmet Preferences support.
So you should be able to do this in your settings:
"emmet.preferences": {
"css.valueSeparator": ":",
}
The default for css.valueSeparator appears to be : , see Emmet Preferences.
BUT, it doesn't work for me for some reason - seems like some completion option is not respecting the css.valueSeparator setting. So you may have better luck - or need to file a github issue on this.

Laravel Tailwind CSS - generate all classes depends on ENV

I just jump to laravel 9 recently (from few months ago), kinda wondering about,
Is it possible to generate all css classes (including custom classes), BUT, only when APP_ENV on .env is not production?
I tried to overcome No.1 (see below explanation), by using const APP_ENV = import.meta.env.VITE_APP_ENV; on tailwind.config.js - so I can do if - else thing, to load things, but it produce an error - offset is longer than source length! offset 81 > length 59. Is it possible to get .env variables on tailwind.config.js?
As I tried to find another way for No.2. I'm narrowing my objective on No.1 and No.2, so, I tried to load all possibilities of my "custom classes" only on dev. By using safelist - to generate all my-own custom class, but it seems not working well, since, the custom class that I want to add doesn't added. I'm using this - pattern: /./ - since I saw this article says so (please, correct me if I'm wrong), but, it's indeed "hitting" all other classes, not just my custom classes. I want to add all of my "custom css class" without adding the variants one-by-one. Maybe something like variants: *? (I already check around on tailwind docs, but couldn't found something like that)
I tried a proper way, to just load all my custom classes like pattern: /ctm/, but as stated on tailwind documentation
Patterns can only match against base utility names like /bg-red-.+/, and won’t match if the pattern includes a variant modifier like /hover:bg-red-.+/.
How can I do so, without me typing & guessing all of the possibility of variants?
Explanation how I try to overcome For question No.1 -
I tried using these code on app.js
const APP_ENV = import.meta.env.VITE_APP_ENV;
if (APP_ENV == 'production') {
//need to use ()
import ('../css/app.css');
}
and with below code on app.blade.php
#if (config('app.env') != 'production')
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio,line-clamp"></script>
#endif
But, when it comes to a custom classes on tailwind.config.js - for example
theme: {
extend: {
fontFamily: {
sans: ['Nunito', ...defaultTheme.fontFamily.sans],
},
colors: {
'ctm-dark-purple': '#2a234f', //<--- custom class here
'ctm-light-dark-purple': '#2a234f', //<--- custom class here
},
},
},
It doesn't generate that custom classes, since I "block" the generated class and swap it into cdn mode on dev.
So, in-summary, how can I "generate all css classes" only on "development" mode? Along with my "custom css class"? If that's not possible, then, is it possible to overcome No.3? I want to add all of my "custom css class" without adding the variants one-by-one. Maybe something like variants: *?
My main reason is simply, I want to apply classes directly on web-browser console and see the changes more faster, rather than back-and-forth modifying-then-save the code on text-editor.
Thanks a lot!
Log -
Updating Problem No.3 - since forgot to mention precisely what I want

2sxc: Configure Tinymce to prevent removes empty span tags

It seems that tinymce removes empty span tags like already discussed here one solution could be to insert in tinymce.init function the following option extended_valid_elements: 'span'.
Is there a way to configure it in 2sxc?
If not, where can i find the js files of tinymce to manually configure it?
Thanks
At the moment there is no central configuration for this. The config itself is currently done in https://github.com/2sic/2sxc-ui/blob/master/src/sxc-edit/fields/string/string-wysiwyg-tinymce.controller.js and is then minified/compiled into the dist-folder.
You can change it, but would have to keep an eye on keeping your changes "alive" when upgrading.

Mageno module idea

I'm working on Magento modules.
After few guides I managed to create module that says "hellow world".
Also I have made some of css code that add simple image border around whole page.
So the problem is: how to combine them together?
I want that when I install my module, image border appears around page.
What should I be looking for? Any tips? I need right path to look for answers
T.y.
You need to to
Create a module
That modifies the global layout such that your CSS is added to the page
Re: number two, there's multiple ways to go about doing this. These days I favor the event/observer method
Add an observer for the controller_action_layout_generate_blocks_after event
Fetch the head block from the layout in your observer method
If you find a head block, add your CSS file to it programtically
The more traditional way is
Configure you module to include an additional layout update XML file
In the default handle of your new layout update XML file, add XML that tells Magento to add your CSS file
That should give you enough to google on and come back with more specific questions. Good luck!

CSS in one line, cant compare free vs paid theme file

This is annoying, I have a wordpress theme with a css file that is all in one long line. I wonder why anyone would do that. Now I have upgraded and I need to compare the old file with the new one so that I can take in the changes. Meld, diff and vimdiff show line difference. I wonder if there is some way to auto format/indent css files so that I can compare them line by line and make some sense to a simple task.
Pass it through a prettifier before comparing.
Its like this as it shouldnt need modification. you can use Styleneat to format it to multi-line. !Very hand tool
Styleneat

Resources