Giter Club home page Giter Club logo

Comments (7)

feedmypixel avatar feedmypixel commented on June 23, 2024 1

πŸ‘ on stylelint

we could

  • add the stylelint rule: unit-whitelist without β€œpx”
  • use variables set in px (for ease of communications with designers and translation of designs)
  • disable/ignore vars file that contains $baseline and $gutter px vars (this being the only place to add them)
  • use postcss-px-to-em https://github.com/macropodhq/postcss-px-to-em for support

note we could also just not replace px values with rem when using pxtorem it would be interesting to see how much weight this adds to the stylesheets

Potentially we would also write a plugin so people can’t /* variables
This would then stop people using magic numbers for padding and margin. $baseline\1.2 or $baseline*3.76

More of a guidance than a heavy handed approach

from assets-frontend.

feedmypixel avatar feedmypixel commented on June 23, 2024

https://www.theguardian.com/info/developer-blog/2014/may/13/improving-sass-code-quality-on-theguardiancom

https://github.com/stylelint/stylelint

from assets-frontend.

rpowis avatar rpowis commented on June 23, 2024

or https://github.com/brigade/scss-lint

from assets-frontend.

rpowis avatar rpowis commented on June 23, 2024

oops

from assets-frontend.

feedmypixel avatar feedmypixel commented on June 23, 2024

Have just done a setup with sass and https://github.com/sasstools/sass-lint using the rule

property-units:
    - 2
    - global:
        - px

And then using post-css with the plugin https://github.com/cuth/postcss-pxtorem to convert px to rem.
In this way we could lint values being used in *.scss and convert after rather than using mixins.

from assets-frontend.

rpowis avatar rpowis commented on June 23, 2024

@feedmypixel Having considered this some more, I think we'd be better off moving margins and paddings into variables with em values (can't use rems due to support) and enforcing the use of those through linting.

It feels like a very heavy handed approach though, but I worry that by allowing the use of arbitrary magic numbers all over the place we'll struggle to maintain consistency in components and layouts.

from assets-frontend.

rpowis avatar rpowis commented on June 23, 2024

Also, we should probably consider using stylelint over sass-lint for it's modularity (e.g. stylelint-selector-bem-pattern). Much the same as eslint for js

from assets-frontend.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.