Socket
Socket
Sign inDemoInstall

vue-loader

Package Overview
Dependencies
Maintainers
1
Versions
304
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-loader - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

compilers/coffee.js

26

index.js

@@ -20,8 +20,22 @@ var htmlMinifier = require("html-minifier")

style = serializer.serialize(node)
var lang = checkLang(node)
if (lang === 'stylus') {
style = require('./compilers/stylus')(style)
} else if (lang === 'less') {
style = require('./compilers/less')(style)
} else if (lang === 'sass' || lang === 'scss') {
style = require('./compilers/sass')(style)
}
break
case 'template':
template = serializer.serialize(node)
if (checkLang(node) === 'jade') {
template = require('./compilers/jade')(template)
}
break
case 'script':
script = serializer.serialize(node)
if (checkLang(node) === 'coffee') {
script = require('./compilers/coffee')(script)
}
break

@@ -54,2 +68,14 @@ }

return output
}
function checkLang (node) {
if (node.attrs) {
var i = node.attrs.length
while (i--) {
var attr = node.attrs[i]
if (attr.name === 'lang') {
return attr.value
}
}
}
}

2

package.json
{
"name": "vue-loader",
"version": "0.1.0",
"version": "0.2.0",
"description": "Webpack loader for single-file Vue components",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -10,5 +10,5 @@ # vue-loader

<style>
.red {
color: #f00;
}
.red {
color: #f00;
}
</style>

@@ -21,9 +21,9 @@

<script>
module.exports = {
data: function () {
return {
msg: 'Hello world!'
module.exports = {
data: function () {
return {
msg: 'Hello world!'
}
}
}
}
</script>

@@ -35,3 +35,3 @@ ```

- extract the styles and insert them with the `insert-css` module.
- extract the template as text and add it to your exported options.
- extract the template and add it to your exported options.

@@ -70,6 +70,37 @@ You can `require()` other stuff in the `<script>` as usual.

## Pre-Processors
You can use preprocessor languages in the component file, just specify the language in your wrapping tags:
``` html
// app.vue
<style lang="stylus">
.red
color #f00
</style>
<template lang="jade">
h1(class="red") {{msg}}
</template>
<script lang="coffee">
module.exports =
data: ->
msg: 'Hello world!'
</script>
```
You need to install the corresponding node modules to enable the compilation. e.g. to get stylus compiled in your Vue components, do `npm install stylus --save-dev`.
Currently supported preprocessors are:
- stylus
- less
- scss
- jade
- coffee-script
## Todos
- Support preprocessors like `<style lang="stylus">`
- Tests
- Browserify transform (vueify?)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc