You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/compiler/generate/css/process.js

19 lines
519 B

8 years ago
import deindent from '../utils/deindent.js';
import spaces from '../../utils/spaces.js';
import transform from './transform.js';
export default function process ( parsed ) {
const scoped = transform( spaces( parsed.css.content.start ) + parsed.css.content.styles, parsed.hash );
return deindent`
let addedCss = false;
function addCss () {
var style = document.createElement( 'style' );
style.textContent = ${JSON.stringify( scoped )};
document.head.appendChild( style );
addedCss = true;
}
`;
}