jouni-kantola / ruin

A CSS post-processor that saves bytes over the wire by shortening names of CSS classes.
MIT License
2 stars 0 forks source link

buggy regex #27

Closed jouni-kantola closed 8 years ago

jouni-kantola commented 8 years ago

Played with mixing CSS according to BEM and JavaScript. The regex to find classes is buggy.

Source file:

.search-area {

}

.search-area__label {

}

.search-area__search-box {

}

.search-area__search-box .description {

}

.register {

}

.register__name {

}

.register__name .description {

}

.name {

}

const person {
    name: "John Doe"
}

Result:


.A03 {

}

.A03__A00 {

}

.A03__A04 {

}

.A03__A04 .A0B {

}

.A09 {

}

.A09__A0F {

}

.A09__A0F .A0B {

}

.A0F {

}

A0D A0E {
    A0F: "JA0G DA08"
}
jouni-kantola commented 8 years ago

In commit https://github.com/davidxcheng/ruin/commit/d0115330d9c08d2a1556ec5125cc76c78cd698c4 the source list of class names was improved. Updating content is still buggy.

jouni-kantola commented 8 years ago

Replace of content now tighter. In commit https://github.com/davidxcheng/ruin/commit/ac1de261c5f458c2edc4ca44852c01852e3c4a71 the above file now looks as follows:

.A {

}

.A0 {

}

.A00 {

}

.A00 .A01 {

}

.A02 {

}

.A03 {

}

.A03 .A01 {

}

.A04 {

}

const person {
    name: "John Doe"
}
jouni-kantola commented 8 years ago

Think we can close this issue, at least for the moment.