Skip to content

Create scss-docs shortcode to get some snippets from the Scss source files#30502

Merged
MartijnCuppens merged 5 commits intomasterfrom
master-mc-scss-docs
Apr 6, 2020
Merged

Create scss-docs shortcode to get some snippets from the Scss source files#30502
MartijnCuppens merged 5 commits intomasterfrom
master-mc-scss-docs

Conversation

@MartijnCuppens
Copy link
Member

@MartijnCuppens MartijnCuppens commented Apr 2, 2020

This should be a little bit easier that creating a custom regex per case.

Usage in .scss:

// scss-docs-start awesome-code
.my-awesome-code {
  // The best CSS in the world
}
// scss-docs-end awesome-code

In the docs files:

{{< scss-docs name="awesome-code" file="scss/_variables.scss" >}}

I don't think the positive lookbehind syntax works in Hugo, so I replaced the comments in the end of the file, there are probably better ways to fix this (bump @XhmikosR)

TODO:

  • Check all occurrences of code snippets
  • Strip !default flags by default

@mdo
Copy link
Member

mdo commented Apr 2, 2020

Oh you brilliant son of a bucket, that's rad. This is fresh as hell.

@ffoodd
Copy link
Member

ffoodd commented Apr 3, 2020

I love this, it'll make things so much easier!

@MartijnCuppens
Copy link
Member Author

Neither the positive lookbehind syntax nor grouping seem to be supported in Hugo regex, so the replacing the comments seems to be the way to go.

Ready for review!

@XhmikosR
Copy link
Member

XhmikosR commented Apr 3, 2020 via email

Copy link
Member

@mdo mdo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks lovely to me, so adding an approval for whatever it's worth :).

@MartijnCuppens MartijnCuppens merged commit 83b49aa into master Apr 6, 2020
@MartijnCuppens MartijnCuppens deleted the master-mc-scss-docs branch April 6, 2020 18:13
olsza pushed a commit to olsza/bootstrap that referenced this pull request Oct 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants