ThisIsManta / stylus-supremacy

A Node.js script that helps formatting Stylus files.
https://thisismanta.github.io/stylus-supremacy
MIT License
88 stars 9 forks source link

Adding '@css {}' automatically caused an error #63

Closed zhysky closed 4 years ago

zhysky commented 4 years ago

I use stylus in vue though import './style.styl' After formating, it adds '@css { }' and my vue project reported an error 'Failed to compile.'
Can format without adding '@css { }'?

$spacing-types = {
    m: margin,
    p: padding
};
$spacing-directions = {
    t: top,
    r: right,
    b: bottom,
    l: left
};
$spacing-base-size = 1rem;
$spacing-sizes = {
   '0': 0,
   '1': .25,
   '2': .5,
   '3': 1,
   '4': 1.5,
   '5': 3
};

for typeKey, type in $spacing-types 
   for directionKey, direction in $spacing-directions 
    for sizeKey, size in $spacing-sizes 
        .{typeKey}{directionKey}{sizeKey} 
        {type}-{direction}: size * $base-font-size;

After formating, it adds '@css { }'

for typeKey, type in $spacing-types 
   for directionKey, direction in $spacing-directions 
    for sizeKey, size in $spacing-sizes 
       .{typeKey}{directionKey}{sizeKey} 
        {type}@css { - }{direction}: size * $base-font-size;
ThisIsManta commented 4 years ago

This will be fixed in v2.14.2 or newer.