cor-lang
Version:
The Language of the Web
167 lines (111 loc) • 7.1 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="assets/style.css">
<link rel="stylesheet" type="text/css" href="assets/highlightjs/cor_light.css">
<link rel="shortcut icon" href="assets/favicon.ico" />
<title>Cor - Get started</title>
</head>
<body>
<span id="top"></span>
<div class="goto-top"><a href="#top">^</a></div>
<nav class="navbar" role="navigation">
<div class="nav content">
<ul class="left">
<li class="inline"><a href="../index.html">Cor</a></li>
<li class="inline"><a href="get_started.html">Get started</a></li>
<li class="inline"><a href="documentation.html">Documentation</a></li>
<li class="inline"><a href="playground/index.html">Playground</a></li>
<li class="inline"><a href="../test/index.html">Run tests</a></li>
</ul>
<ul class="right">
<li class="inline"><a class="icon-github" href="https://github.com/yosbelms/cor" target="_blank"></a></li>
</ul>
</div>
</nav>
<div class="body content">
<h1 id="getstarted">Get started</h1>
<p>Cor promotes modularity, conventions and code organization, it is built for scalable applications development. The syntax enforces to write mantainable code. You can use any library written in javascript or import from javascript any library written and built with Cor.</p>
<h2 id="download">Download</h2>
<p>Cor can be downloaded in several ways depending on different needs. The Cor compiler can run in any javascript environment however it's priority is the browser and Node.js.</p>
<h3 id="fromgithub">From GitHub</h3>
<p>Available releases can be downloaded from <a href="https://github.com/yosbelms/cor/releases">here</a>. Once downloaded, decompress the bundle (.zip or .tar). The main script can be found at <code>cor/dis/cor.js</code> ready to be embedded in HTML pages for production see, <a href="#inthebrowser">In the Browser</a>.</p>
<h3 id="withnpm">With NPM</h3>
<p>To install it globally:</p>
<pre><code>npm install -g cor-lang
</code></pre>
<p>You must use this way for CLI usage.</p>
<p>To install it locally:</p>
<pre><code>npm install cor-lang
</code></pre>
<p>You must use this way for programatic usage or for client-side development.</p>
<h3 id="withbower">With Bower</h3>
<p>If you prefer Bower as package manager make sure to have Node.js and Bower installed.</p>
<p>To install Bower run:</p>
<pre><code>npm install -g bower
</code></pre>
<p>Once installed you can install Cor, from the CLI run:</p>
<pre><code>bower install cor-lang
</code></pre>
<p>After that, you are able to include the distribution script located at bower_components/cor/dist/cor.js in any html file through the <code><script></script></code> tag.</p>
<pre><code><script type="text/javascript" src="bower_components/cor/dist/cor.js"></script>
</code></pre>
<h2 id="firststeps">First steps</h2>
<h3 id="innodejs">In Node.js</h3>
<p>The CLI tools are available as a <a href="http://nodejs.org">Node.js</a> utility. To use Cor from Node.js you must install it using NPM:</p>
<pre><code>npm install -g cor-lang
</code></pre>
<p>Leave off the <code>-g</code> if you don't wish to install globally:</p>
<pre><code>npm install cor-lang
</code></pre>
<p>Execute a script:</p>
<pre><code>cor run /path/to/source.cor
</code></pre>
<p>Compile a script:</p>
<pre><code>cor compile /path/to/source.cor
</code></pre>
<p>Once globally installed using NPM you have access to <code>cor</code> command which can compile and build sources. For CLI usage run <code>cor help</code> command. The files containing source code should have <code>.cor</code> extension.</p>
<p>The <code>build</code> command will compile and pack source code and its dependences to one file. The <code>compile</code> command will just compile the provided source code contained in a directory or file.</p>
<p>For commands reference see <a href="documentation.html#commands">Commands</a>.</p>
<h3 id="inthebrowser">In the browser</h3>
<p>Cor is designed with client-side development in mind, it dynamically load files using XHTTPRequest object, so that, hot-realoading is an amazing feature to keep you away from CLI compile/watch tools for a smooth client-side development. Because the XHTTPRequest object, application source must be behind a web server (Apache HTTP Server, Nginx, or that you like). The Cor CLI tools provides a static HTTP server through <code>http</code> command which can be used with the same purpose.</p>
<p>After install Cor globally, you may run:</p>
<pre><code>// from the directory to be served
cor http
</code></pre>
<p>The server will publish in port <code>9000</code> unless you have chosen a different one.</p>
<p>To bootstrap Cor in development mode include Cor library (located at <code>node_modules/cor-lang/dist/cor.js</code> if NPM was used to install it locally) inside a HTML file using a <code>script</code> tag, then specify the application entry script using <code>data-entry="path/to/script.cor"</code> in a separated script tag, for example:</p>
<pre><code><html>
<script type="text/javascript" src="node_modules/cor-lang/dist/cor.js"></script>
<script data-entry="hello.cor"></script>
</html>
</code></pre>
<p>See the <a href="documentation.html">documentation</a> for further reading.</p> <div class="full-rule"></div>
<div class="feature footer-links">
<ul>
<li><a href="https://github.com/yosbelms/cor">GitHub Repository</a></li>
<li>·</li>
<li><a href="http://github.com/yosbelms/cor/issues">Issues</a></li>
</ul>
</div>
</div>
<div class="feature footer">
<p>Designed, written, and built with love by <a href="https://github.com/yosbelms" target="_blank">Yosbel Marín</a>. Code licensed under <a href="https://github.com/yosbelms/cor/blob/master/LICENSE" target="_blank">BSD</a>, documentation under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
</div>
<script type="text/javascript" src="assets/highlightjs/highlight.js"></script>
<script type="text/javascript"> hljs.initHighlightingOnLoad(); </script>
<!--start clicky stub-->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-73271106-1', 'auto');
ga('send', 'pageview');
</script>
<!--end of clicky stub-->
</body>
</html>