With .vue we can put style, script, template to one file. It's good for component management.
But some times need a tiny(size is important) like embedded SPA. Frameworks should be banned and focus of pre-processing engineering. Now we can put style.scss script.js template.pug into sample-widget, and use webpack-loaders to do this.
Each time requiring sample-widget should be:
import from 'sample-widget/style.scss'
import invoke from 'sample-widget/script.js'
import render from 'sample-widget/template.pug'
targetElement.appendChild(string2dom(render(data)))
invoke(data)
Looks little stupid.
Is there some pre-processing engineering solutions make pure components smart like .vue file? (with loaders like vue-loader for extracting)
Aucun commentaire:
Enregistrer un commentaire