You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nativescript Ignores CSS Class Names Separated By Newlines #9402
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
CLI:
Cross-platform modules:
Android Runtime:
iOS Runtime:
XCode Version:
Plugin(s):
Describe the bug
In my Nativescript-Vue project, Nativescript will ignore HTML class names when they span across multiple lines.
<!-- this works -->
<Button
text="My Button"
class="font-bold mt-10 p-4 text-base bg-primary-600 text-white"
/>
<!-- this doesn't work -->
<Button
text="My Button"
class="
font-bold
mt-10
p-4
text-base
bg-primary-600
text-white
"
/>
To Reproduce
Create an element in your project that has the class names formatted like above.
Expected behavior
Multiline HTML class property works in all the major browsers no problem - you can basically use any number of whitespace characters between class names. Since Nativescript tries to emulates CSS conventions it should try to reproduce the way HTML classes are typically parsed. This will ensure consistent behavior for things like auto-formatters and parsers (in my case the newest version of Prettier is now unusable with Nativescript. See below.)
Sample project
N/A
Additional context
I ran into this bug when I upgraded prettier to v2.3. In the latest version they changed the way they handle the HTML class property (see details here). To summarize the change, css classes are kept on a single line up until the line length limit is reached after which it will break the css classes into multiple lines.
Once I upgraded prettier, it ended up reformatting the css classes across the project and breaking my styles (I'm using tailwind so you can imagine this happened in a lot of places). I have since reverted back to prettier v2.x.x until it's safe to upgrade.
changed the title [-]Nativescript Ignores Multiline Class Names on Multiple Lines[/-][+]Nativescript Ignores CSS Classes on Multiple Lines[/+]on May 16, 2021
changed the title [-]Nativescript Ignores CSS Classes on Multiple Lines[/-][+]Nativescript Ignores CSS Class Names Separated By Newlines[/+]on May 16, 2021
Activity
[-]Nativescript Ignores Multiline Class Names on Multiple Lines[/-][+]Nativescript Ignores CSS Classes on Multiple Lines[/+][-]Nativescript Ignores CSS Classes on Multiple Lines[/-][+]Nativescript Ignores CSS Class Names Separated By Newlines[/+]fix(core): split className on any whitespace (NativeScript#11577)