Skip to content

Instantly share code, notes, and snippets.

@protomorph
Last active October 4, 2023 01:12
Show Gist options
  • Select an option

  • Save protomorph/06e0230691ad2a2ffed908cece6fade4 to your computer and use it in GitHub Desktop.

Select an option

Save protomorph/06e0230691ad2a2ffed908cece6fade4 to your computer and use it in GitHub Desktop.

Revisions

  1. protomorph revised this gist Oct 4, 2023. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion css.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@

    import tagged from 'tagged.js'

    const css = tagged(str => {
    const css = tagged(function (str) {
    const css = new CSSStyleSheet()
    return css.replace(str.trim())
    })
    2 changes: 1 addition & 1 deletion html.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@

    import tagged from 'tagged.js'

    const html = tagged(str => {
    const html = tagged(function (str) {
    const fragment = document.createRange()
    return fragment.createContextualFragment(str.trim())
    })
  2. protomorph revised this gist Oct 3, 2023. 3 changed files with 15 additions and 6 deletions.
    9 changes: 9 additions & 0 deletions css.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@

    import tagged from 'tagged.js'

    const css = tagged(str => {
    const css = new CSSStyleSheet()
    return css.replace(str.trim())
    })

    export default css
    2 changes: 1 addition & 1 deletion html.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@

    impprt tagged from 'tagged.js'
    import tagged from 'tagged.js'

    const html = tagged(str => {
    const fragment = document.createRange()
    10 changes: 5 additions & 5 deletions tagged.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@

    // https://github.com/ryanmorr/tagged
    const tagged = (callback, mutator = (val) => val) => (strings, ...values) => callback(
    strings.raw.reduce((acc, str, i) => acc + (mutator(values[i - 1])) + str)
    )

    export default tagged
    export default function tagged (callback, mutator = val => val) {
    return (strings, ...values) => callback(
    strings.raw.reduce((acc, str, i) => acc + (mutator(values[i - 1])) + str)
    )
    }
  3. protomorph revised this gist Oct 3, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions html.js
    Original file line number Diff line number Diff line change
    @@ -5,3 +5,5 @@ const html = tagged(str => {
    const fragment = document.createRange()
    return fragment.createContextualFragment(str.trim())
    })

    export default html
  4. protomorph created this gist May 12, 2023.
    7 changes: 7 additions & 0 deletions html.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@

    impprt tagged from 'tagged.js'

    const html = tagged(str => {
    const fragment = document.createRange()
    return fragment.createContextualFragment(str.trim())
    })
    7 changes: 7 additions & 0 deletions tagged.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@

    // https://github.com/ryanmorr/tagged
    const tagged = (callback, mutator = (val) => val) => (strings, ...values) => callback(
    strings.raw.reduce((acc, str, i) => acc + (mutator(values[i - 1])) + str)
    )

    export default tagged