import { Layer } from '../types' ; import generateScss from './generateScss' ; import generateCSS from './generateCSS' ; import generateBody from './generateBody' ; import { picassoTrans } from '../../../picasso-trans/src' ; import { WebScale , Unit , ColorFormat , CodeType } from '../../../sketch-dsl/src' ; description param { Layer [ ] } data param { string } outputPath export const picassoWebCode = ( data , size ) => { try { const platform = [ 375 , 750 ] . includes ( Math . round ( size ) ) ? 2 : 1 ; data = picassoTrans ( data , { scale : WebScale . Points , unit : Unit . WebPx , colorFormat : ColorFormat . RGBA , codeType : CodeType . WebPx , } ) ; const body = generateBody ( data , '' ) ; let scss = '' ; scss += generateScss ( data , size ) ; const css = generateCSS ( data , size , platform ) ; return { scss , css , html : body , vueHtml : body , reactHtml : body . replace ( /class=/ig , 'className=' ) , } ; } catch ( error ) { console . log ( error ) ; } } ;