简体   繁体   中英

Does JavaScript(ES2015) have preprocessor support for omit braces?

Does JavaScript have preprocessor support for omit braces like in Stylus and Jade ?

For example:

<style lang="stylus" scoped>
div
  background-color red
p
  color blue
</style>

<script>
import something from './something';

export default {
  vuex: {
    getters: {
      todos: state => state.todos;
    }
  }
};
</script>

<template lang="jade">
div
  p Hello World!
</template>

I want to write ES6 code that just like:

<script lang="?">
import something from './something'

export default
  vuex:
    getters:
      todos: state => state.todos
</scrip>

I think you're looking for something like CoffeeScript . It's a preprocessor for JavaScript that is white space sensitive, like Jade, so you often do not need a lot of punctuation.

JavaScript/ECMAScript (as a language) does not have any preprocessor support at all, because it doesn't need compilation or preprocessing - it's an interpreted scripting language.

You can however write a custom preprocessor that does whatever you want and apply it manually to your script files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM