How to use babel-plugin-emotion - 9 common examples

To help you get started, we’ve selected a few babel-plugin-emotion examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emotion-js / emotion / site / plugins / gatsby-remark-live-code / index.js View on Github external
}`
      )
    }
    if (
      node.lang === 'jsx' &&
      // yes, i know this won't work if you don't use line comments and stuff
      // but adding a whole js parser and stuff to do this would be more effort than it's worth
      livePattern.test(node.value)
    ) {
      let cleanValue = node.value.replace('// @live', '').trim()
      node.type = `html`
      node.value = escapeGoat.escapeTag``
    }
  })
}
github emotion-js / emotion / site / src / components / live / worker.js View on Github external
// https://github.com/developit/preact-www/blob/cb47a5015ea666930ead6eebc2917307db6c1db6/src/components/controllers/repl/worker.js

importScripts('https://unpkg.com/@babel/standalone@7.0.0/babel.min.js')

const babelPluginEmotion = require('babel-plugin-emotion').default

global.window = global

addEventListener('message', ({ data }) => {
  let { id, method, params } = data
  Promise.resolve()
    .then(() => ACTIONS[method](...[].concat(params)))
    .then(result => postMessage({ id, result }))
    .catch(({ message, loc }) => postMessage({ id, error: { message, loc } }))
})

const options = {
  presets: [
    'es2015',
    'react',
    [
github emotion-js / emotion / site / src / components / live / worker.js View on Github external
// https://github.com/developit/preact-www/blob/cb47a5015ea666930ead6eebc2917307db6c1db6/src/components/controllers/repl/worker.js

importScripts('https://unpkg.com/@babel/standalone@7.0.0/babel.min.js')

const babelPluginEmotion = require('babel-plugin-emotion').default

global.window = global

addEventListener('message', ({ data }) => {
  let { id, method, params } = data
  Promise.resolve()
    .then(() => ACTIONS[method](...[].concat(params)))
    .then(result => postMessage({ id, result }))
    .catch(({ message, loc }) => postMessage({ id, error: { message, loc } }))
})

const options = {
  presets: [
    'es2015',
    'react',
    [
github emotion-js / emotion / packages / preact-emotion / macro.js View on Github external
module.exports = require('babel-plugin-emotion').macros.createStyledMacro({
  importPath: '@emotion/preact-styled-base',
  isWeb: true
})
github emotion-js / emotion / packages / preact-styled / macro.js View on Github external
module.exports = require('babel-plugin-emotion').macros.createStyledMacro({
  importPath: '@emotion/preact-styled-base',
  isWeb: true
})
github emotion-js / emotion / packages / styled / macro.js View on Github external
module.exports = require('babel-plugin-emotion').macros.createStyledMacro({
  importPath: '@emotion/styled-base',
  originalImportPath: '@emotion/styled',
  isWeb: true
})
github emotion-js / emotion / packages / react-emotion / macro.js View on Github external
module.exports = require('babel-plugin-emotion').macros.createStyledMacro({
  importPath: '@emotion/styled-base',
  isWeb: true
})
github emotion-js / emotion / packages / css / macro.js View on Github external
module.exports = require('babel-plugin-emotion').macros.css
github emotion-js / emotion / packages / emotion / macro.js View on Github external
module.exports = require('babel-plugin-emotion').macros.createEmotionMacro(
  'emotion'
)

babel-plugin-emotion

A recommended babel preprocessing plugin for emotion, The Next Generation of CSS-in-JS.

MIT
Latest version published 4 years ago

Package Health Score

88 / 100
Full package analysis

Popular babel-plugin-emotion functions