Home > Web Front-end > JS Tutorial > How to write code blocks with sublime

How to write code blocks with sublime

一个新手
Release: 2017-09-11 09:47:03
Original
2584 people have browsed it

今天在用canvas绘图时,看到有许多相同的代码,就想介绍sublime里面为了加快代码编写,而采用代码片段。
这里只写我了解的。其他需要,请读者自行了解。

打开位置,见下图:

How to write code blocks with sublime

  • 打开页面

    How to write code blocks with sublime

  • 例子

<How to write code blocks with sublime>
    <content>
        <![CDATA[
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>${1}</title>
</head>
<body>
    <canvas id="demo">
    </canvas>
    <script>
    (function() {
        var canvas = document.getElementById(&#39;demo&#39;);
        canvas.width = ${2:agewg};
        canvas.height = ${3};
        canvas.style.border = &#39;1px solid #000&#39;;
        var ctx = canvas.getContext(&#39;2d&#39;);
       ${4}
        ctx.stroke();
    })();
     \$(function() {

  });
    </script>
</body>
</html>
]]>
    </content>
    <!-- Optional: Set a tabTrigger to define how to trigger the How to write code blocks with sublime -->
    <tabTrigger>cans</tabTrigger>
    <!-- Optional: Set a scope to limit where the How to write code blocks with sublime will trigger -->
    <!-- <scope>source.python</scope> --></How to write code blocks with sublime>下面图片和上面代码块一样的内容,为了说明清楚,加的图片:
Copy after login

How to write code blocks with sublime

How to write code blocks with sublime

  • 保存
    How to write code blocks with sublime

  • 输入快捷键

How to write code blocks with sublime

The above is the detailed content of How to write code blocks with sublime. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template