zoukankan      html  css  js  c++  java
  • [React] React Fundamentals: Precompile JSX

    The JSX Transformer library is not recommended for production use. Instead, you'll probably want to precompile your JSX into JavaScript.

    Install:

    npm install react-tools -g

    Run:

    jsx dev build --no-cache-dir --watch
    
    //watch dev dir and compile js to build dir

    You also need to change html a little bit:

    dev/index.html

    <!doctype html>
    <html lang="en">
    <head>
        <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" href="style.css"/>
        <script src="//fb.me/react-0.13.3.js"></script>
        <script src="//fb.me/JSXTransformer-0.13.3.js"></script>
        <meta charset="utf-8">
        <title>Compiler Dev</title>
    </head>
    <body>
    <script  type="text/jsx" src="app.js"></script>
    </body>
    </html>

    build/index.html

    <!doctype html>
    <html lang="en">
    <head>
        <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" href="style.css"/>
        <script src="//fb.me/react-0.13.3.js"></script>
        <!-- no jsx file included-->
        <meta charset="utf-8">
        <title>Compiler Dev</title>
    </head>
    <body>
    <!-- no type="jsx/text" -->
    <script src="app.js"></script>
    </body>
    </html>
  • 相关阅读:
    (14)模板的导入和继承
    (13)自定意义标签和过滤器 (templatetags)
    (12)模板语言-with
    (11)模板语言-if判断
    (0)diango、ORM的语法
    python修炼12 -----协程
    python 修炼11 ----------线程进程
    线程 进程 定义
    Python基础之面向对象进阶
    Python ---------copy
  • 原文地址:https://www.cnblogs.com/Answer1215/p/4764462.html
Copyright © 2011-2022 走看看