doc04 - KoreaSenchaUserGroup/Lab1 GitHub Wiki

DOC 4. [Overview] Using and Creating Builds

원문 : http://docs.sencha.com/touch/2-0/#!/guide/building

λ²ˆμ—­ : μ •κ±΄μš° [Github:NangChun]

Sencha Touch 2 comes with a brand new class system that features an ability to dynamically load classes when they are needed. This has many benefits in both development and production.

In development, dynamic loading means you get a file-by-file stack trace, which makes it much easier to debug problems with your application. For production, we provide a build tool that enables you to easily create a minified custom build that only includes the classes your app actually uses, meaning loading times are often reduced for your users.

λΉŒλ“œν™˜κ²½ λ§Œλ“€κ³  μ‚¬μš©ν•˜κΈ°

ν•„μš”ν•  λ•Œ λ™μ μœΌλ‘œ 클래슀λ₯Ό λ‘œλ“œν•˜λŠ” λŠ₯λ ₯을 κ°–μΆ˜ μƒˆλ‘œμš΄ μ’…λ₯˜μ˜ 클래슀 μ‹œμŠ€ν…œκ³Ό ν•¨κ»˜ μ„Όμ°¨ν„°μΉ˜2κ°€ μ œκ³΅λ©λ‹ˆλ‹€. 개발과 생산성 λͺ¨λ‘ λ§Žμ€ μž₯점이 μžˆμŠ΅λ‹ˆλ‹€.

κ°œλ°œμ‹œμ—λŠ”, 동적 λ‘œλ”©μ€ νŒŒμΌκ°„ μŠ€νƒ 좔적을 얻을 수 μžˆμŒμ„ μ˜λ―Έν•˜λ©°, 훨씬 μ‰½κ²Œ μ‘μš© ν”„λ‘œκ·Έλž¨ 문제λ₯Ό 디버깅할 수 μžˆμŠ΅λ‹ˆλ‹€. μ œμž‘μ„ μœ„ν•΄μ„ , customλΉŒλ“œλ₯Ό 앱이 μ‹€μ§ˆμ μœΌλ‘œ μ‚¬μš©ν•˜λŠ” 클래슀λ₯Ό ν¬ν•¨ν•˜μ—¬ μΆ•μ†Œν•˜κ³  λΉŒλ“œλ₯Ό κ°€λŠ₯ν•œ μ‰½κ²Œ λ§Œλ“œλŠ” 도ꡬλ₯Ό μ œκ³΅ν•˜λ©°, 주둜 μ‚¬μš©μžλ₯Ό μœ„ν•œ λ‘œλ”©μ‹œκ°„ κ°μ†Œλ₯Ό λͺ©μ μœΌλ‘œ ν•©λ‹ˆλ‹€.

Choosing a Build

Sencha Touch 2 ships with 5 builds out of the box. If you just want to get up and running as quickly as possible it's best to simply use sencha-touch-debug.js while developing your app locally then switch to sencha-touch.js in production. The other three builds are good for debugging in production, running in production without a custom build, and migrating your 1.x app to 2.x. Because each build is good for a different purpose an created using a different set of build options we've created a simple table below that shows how each one is configured:

Name Type Loader Minified Comments Debug Compat Usage
sencha-touch-debug.js Core βœ” βœ” βœ” Use when developing your app locally
sencha-touch.js Core βœ” βœ” Use in production with a custom build
builds/sencha-touch-all.js All βœ” Use in production if you don't have a custom build
builds/sencha-touch-all-debug.js All βœ” βœ” Use to debug your app in staging/production
builds/sencha-touch-all-compat.js All βœ” βœ” βœ” Use to migrate your 1.x app to 2.x

Note that the last 3 builds are contained within the 'builds' directory in the SDK download. If the table above is not self-explanatory, here's a little more detail on what each option means:

  • Type: either "Core" or "All" - Core includes the base classes but none of the Components, All means everything is included
  • Loader: whether dynamic loading is activated or not. Only sencha-touch.js has this activated by default
  • Minified: means the build has been compressed with YUI compressor
  • Comments: means the build still contains the JSDoc comments (these are usually stripped in production to speed up downloads)
  • Debug: means that the build will give you debug messages such as telling you if you have misconfigured a class
  • Compat: means that code to provide backwards compatibility with Sencha Touch 1.x is present in the build

Again, use sencha-touch-debug.js in development mode then switch to either sencha-touch.js or sencha-touch-all.js plus a custom build in production.

λΉŒλ“œ 선택

μ„Όμ°¨ν„°μΉ˜2λŠ” 5κ°€μ§€ λΉŒλ“œλ“€κ³Ό ν•¨κ»˜ μΆœμ‹œλ©λ‹ˆλ‹€. 깨우고 μ΅œλŒ€ν•œ λΉ λ₯΄κ²Œ μ‹€ν–‰ν•˜λ €λŠ” μˆœκ°„μΌ 경우 κ°„λ‹¨νžˆ sencha-touch.jsλ₯Ό μ‚¬μš©ν•˜κ³  μ œμž‘μ‹œμ—” λ‘œμ»¬μ—μ„œ 앱을 개발 ν• λ•Œλ©΄ sencha-touch-debug.js둜 μ „ν™˜ν•˜μ—¬ μ‚¬μš©ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€. μ œμž‘ν• λ•Œ 디버깅에 쒋은 λ‹€λ₯Έ μ„Έκ°€μ§€ λΉŒλ“œλŠ”, custom λΉŒλ“œ 없이도 μ œμž‘ν•˜μ—¬ μ‹€ν–‰λ©λ‹ˆλ‹€, 그리고 1.x μ—μ„œ 2.x둜 μ΄μ „ν•©λ‹ˆλ‹€. 각 λΉŒλ“œλŠ” λ‹€λ₯Έ λͺ©μ μ„ μœ„ν•΄ μžˆλŠ” 것이기 λ•Œλ¬Έμ— μ•„λž˜μ— κ°„λ‹¨ν•œ ν…Œμ΄λΈ”μ„ μž‘μ„±ν•΄ μ˜΅μ…˜μ„ λΉŒλ“œμ˜ 각기 λ‹€λ₯Έ μ„ΈνŠΈ ν•˜λ‚˜ν•˜λ‚˜λ‘œ κ΅¬μ„±ν•˜λŠ” 방법을 μ‚¬μš©ν•˜μ—¬ λ§Œλ“œλŠ” 것이 μ’‹λ‹€λŠ” 것을 보여 μ€λ‹ˆλ‹€ :

이름 μ’…λ₯˜ λ‘œλ” μΆ•μ†Œλ¨ 주석 디버그 콀팻 μ‚¬μš©λ²•
sencha-touch-debug.js μ½”μ–΄ βœ” βœ” βœ” 둜컬 μ•± κ°œλ°œμ‹œ μ‚¬μš©
sencha-touch.js μ½”μ–΄ βœ” βœ” custom λΉŒλ“œμ™€ ν•¨κ»˜ μ œμž‘μ— μ‚¬μš©
builds/sencha-touch-all.js μ „λΆ€ βœ” custom λΉŒλ“œκ°€ μ—†λ‹€λ©΄ μ œμž‘μ— μ‚¬μš©
builds/sencha-touch-all-debug.js μ „λΆ€ βœ” βœ” μž„μ‹œλ‘œ / μ œμž‘ν•˜λŠ” 앱을 λ””λ²„κΉ…ν•˜λŠ”λ° μ‚¬μš©
builds/sencha-touch-all-compat.js μ „λΆ€ βœ” βœ” βœ” 1.x μ•± μ—μ„œ 2.x둜 μ΄μ „ν•˜κΈ° μœ„ν•΄ μ‚¬μš©

λ§ˆμ§€λ§‰ 3κ°€μ§€ λΉŒλ“œλŠ” SDK λ‹€μš΄λ‘œλ“œ μ•ˆμ˜ 'λΉŒλ“œ'디렉토리 내에 ν¬ν•¨λ˜μ–΄ μžˆλŠ”μ§€ μ°Έκ³  ν•©λ‹ˆλ‹€. λ‹€λ§Œ μœ„μ˜ ν…Œμ΄λΈ”λ‘œ 이해가 μ•ˆλ  경우, μ—¬κΈ°μ„œ 쒀더 μžμ„Ένžˆ 각각의 μ˜΅μ…˜μ˜ 의미λ₯Ό μ•Œμˆ˜ μžˆμŠ΅λ‹ˆλ‹€:

  • μ’…λ₯˜: "μ½”μ–΄"λ˜λŠ” "μ „λΆ€" 쀑 ν•˜λ‚˜ μž…λ‹ˆλ‹€ - μ½”μ–΄λŠ” κΈ°λ³Έ ν΄λž˜μŠ€λŠ” ν¬ν•¨λ˜μ—ˆμœΌλ‚˜ μ»΄ν¬λ„ŒνŠΈκ°€ μ—†μœΌλ©°, μ „λΆ€λŠ” λͺ¨λ“ κ²ƒμ„ ν¬ν•¨ν•˜μ˜€λ‹€λŠ” 의미
  • λ‘œλ”: λ™μ λ‘œλ”©μ΄ ν™œμ„±ν™” λ˜μ—ˆλŠ” 지에 λŒ€ν•œ μ—¬λΆ€μž…λ‹ˆλ‹€. sencha-touch.js 만이 기본적으둜 ν™œμ„±ν™”
  • μΆ•μ†Œλ¨: YUI μ••μΆ•κΈ°λ‘œ λΉŒλ“œκ°€ μ••μΆ•λ˜μ—ˆμŒμ„ 의미
  • 주석: λΉŒλ“œκ°€ 아직 JSDoc 주석이 아직 ν¬ν•¨λ˜μ—ˆμŒμ„ 의미 (보톡 λ‹€μš΄λ‘œλ“œ 속도λ₯Ό 높이기 μœ„ν•΄ μ œμž‘μ‹œ μ œμ™Έ)
  • 디버그: λΉŒλ“œκ°€ 잘λͺ» κ΅¬μ„±λœ ν΄λž˜μŠ€κ°€ μžˆμ„ 경우λ₯Ό λ§ν•˜λŠ” λ“±μ˜ 디버그 λ©”μ‹œμ§€κ°€ 제곡 λœλ‹€λŠ” 것을 의미
  • Compat: μ„Όμ°¨ν„°μΉ˜1.x κ³Ό ν•¨κ»˜ ν•˜μœ„ ν˜Έν™˜μ„±μ„ μ œκ³΅ν•˜λŠ” μ½”λ“œκ°€ λΉŒλ“œμ— μ‘΄μž¬ν•¨μ„ 의미

λ‹€μ‹œ, μ œμž‘μ€‘μ— sencha-touch.js λ˜λŠ” sencha-touch-all.js 쀑 ν•˜λ‚˜λ₯Ό 개발자 λͺ¨λ“œμ‹œμ— sencha-touch-debug.js 둜 μ „ν™˜ν•˜μ—¬ μ‚¬μš©ν•©λ‹ˆλ‹€.

Creating your own Build

In the vast majority of cases a Sencha Touch 2 app should use a custom build in production, for 2 main reasons:

  1. Custom builds include only the framework classes your app is actually using, saving on download time
  2. A custom build includes all of your app classes in a single file, which means only one network request

Reason 2 is especially important. Most applications will have a large number of files (sometimes hundreds), and loading them one by one, especially over a 3g network, can take a long time. That's because each request can add several hundred milliseconds of delay, depending on network conditions, which can easily add several seconds to your application's overall load time.

To ensure your applications load quickly in production we have created the Sencha SDK Tools, which includes a build script that automatically does all of this:

  1. Figures out which framework classes your application is actually using
  2. Figures out which application classes are loaded when your application boots up
  3. Combines all of these into a single file, with the classes in the right order
  4. Strips out all of the JSDoc comments, then minifies the file so it's as small as possible

Installing the SDK Tools

If you don't already have the Sencha SDK Tools installed, you'll need to install them before you can create a build. A quick way to check to see if the tools are already installed is to open up your command line terminal and type in 'sencha' - if the SDK Tools are present you should see something like this:

1

Output of running 'sencha' on the command line if the SDK Tools are installed

If you get an error instead you probably don't have the SDK Tools installed. Just hit the download button on http://www.sencha.com/products/sdk-tools, double-click the downloaded file to install then try the sencha command again and everything should work.

Generating a Build

** Note: ** The build steps are expected to be simplified in the next release (2.0.0 Beta 2) so please check this page again once that release is available.

We're going to assume you have an app that works locally already and that you just want to build it for production. If you don't have an app yet or don't know what this is all about, check out the getting started guide.

Assuming you app does work locally though, let's proceed. We're going to use the Twitter example that comes with the Sencha Touch SDK to illustrate how this works. Firstly let's familiarize ourselves with that example's index.html file:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Twitter</title>

    <link rel="stylesheet" href="resources/css/application.css" type="text/css">

    <script type="text/javascript" src="touch/sencha-touch-debug.js"></script>
    <script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>

Notice that we're loading sencha-touch-debug.js and app.js - this combination is what allows us to use dynamic loading while developing our app, and is the basis for the SDK Tools' ability to generate a minimal build. We'll come back to this html file's contents shortly.

Back to the command line - first you'll need to cd into to the directory that your app can be found in on your hard drive:

cd ~/path/to/my/app

Next you'll need to generate a jsb file for your app. A jsb file is basically a list of all the classes that your application uses. Thankfully, the SDK Tools do this for you:

sencha create jsb -a index.html -p app.jsb3

This command takes your index.html file (the same file you use in your browser while developing your app), figures out all of the class dependencies and writes them out into a file called app.jsb3. From here we just need one more command to actually generate the build itself:

sencha build -p app.jsb3 -d ./

This final command takes all of the files listed in the jsb and combines them into a single file, which it then minifies to make as small as possible. The output is a file called all-classes.js, which contains all of the framework classes plus your application classes.

Updating your HTML file

The final step to prepare your app for production is to update your HTML file to use sencha-touch.js instead of sencha-touch-debug.js, and to load your newly-generated all-classes.js. Here's how our twitter example file ends up:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Twitter</title>

    <link rel="stylesheet" href="resources/css/application.css" type="text/css">

    <script type="text/javascript" src="touch/sencha-touch.js"></script>
	<script type="text/javascript" src="all-classes.js"></script>
    <script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>

Rather than change your main index.html file all the time, it's common to create a duplicate called index-production.html that looks like the file above. Many developers will produce a simple deploy script that copies the app into a deploy folder and renames index-production.html to index.html automatically so that the build can simply be uploaded.

Upcoming Changes to the Builder

Although it's only a few steps, we'd like to improve both the workflow and the output of the builder for the next release of Sencha Touch. If you're building using Sencha Touch 2.0 beta 1 please be sure to check back when you upgrade to a later release as it is likely the steps and output will have changed slightly.

ν•˜λ‚˜μ˜ λΉŒλ“œλ‘œ λ§Œλ“€κΈ°

λŒ€λΆ€λΆ„μ˜ 경우 μ„Όμ°¨ν„°μΉ˜2 앱은 μ œμž‘μ— custom λΉŒλ“œλ₯Ό μ‚¬μš©ν•˜κ³  μžˆμ„ 것이며, 2κ°€μ§€ 이유 λ•Œλ¬Έμž…λ‹ˆλ‹€ :

  1. custom λΉŒλ“œλŠ” 앱을 μ‹€μ œλ‘œ μ‚¬μš©ν•˜λŠ” κ²½μš°μ—λ§Œ ν”„λ ˆμž„μ›Œν¬ ν΄λž˜μŠ€κ°€ ν¬ν•¨λ©λ‹ˆλ‹€, λ‹€μš΄λ‘œλ“œ μ‹œκ°„μ„ μ ˆμ•½ν•©λ‹ˆλ‹€
  2. custom λΉŒλ“œλŠ” ν•˜λ‚˜μ˜ νŒŒμΌμ—μ„œ μ‘μš© ν”„λ‘œκ·Έλž¨μ˜ 클래슀λ₯Ό λͺ¨λ‘ 포함, 이것은 ν•˜λ‚˜μ˜ λ„€νŠΈμ›Œν¬λ§Œ μš”μ²­ν•¨μ„ μ˜λ―Έν•©λ‹ˆλ‹€

2의 μ΄μœ λŠ” μ€‘μš”ν•©λ‹ˆλ‹€. λŒ€λΆ€λΆ„μ˜ μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ€ λ§Žμ€μˆ˜μ˜ νŒŒμΌμ„(λ•Œλ‘œλŠ” 수백의) κ°€μ Έμ•Ό ν•˜κ³ , ν•˜λ‚˜μ”© λ‘œλ“œ ν•˜λ©°, 특히 3g λ„€νŠΈμ›Œν¬λ₯Ό ν†΅ν•΄μ„œ, μ‹œκ°„μ΄ 였래 걸릴 수 μžˆμŠ΅λ‹ˆλ‹€. λ„€νŠΈμ›Œν¬ 쑰건에 따라, 각 μš”μ²­μ΄ 수백 λ°€λ¦¬μ΄ˆλ₯Ό μΆ”κ°€λ‘œ μ§€μ—° μ‹œν‚¬μˆ˜ 있기 λ•Œλ¬Έμ—, μ‘μš© ν”„λ‘œκ·Έλž¨μ˜ 전체적인 λ‘œλ“œμ‹œκ°„μ„ λͺ‡μ΄ˆ 정도 μ‰½κ²Œ μΆ”κ°€ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

μ œμž‘ 쀑 μ‘μš©ν”„λ‘œκ·Έλž¨μ˜ μ‹ μ†ν•œ λ‘œλ“œλ₯Ό 보μž₯ν•˜κΈ°μœ„ν•΄ SDK 도ꡬλ₯Ό λ§Œλ“€μ—ˆμŠ΅λ‹ˆλ‹€, λ‹€μŒ λΉŒλ“œ 슀크립트λ₯Ό λͺ¨λ‘ μžλ™μœΌλ‘œ ν¬ν•¨ν•©λ‹ˆλ‹€:

  1. ν”„λ ˆμž„μ›Œν¬ ν΄λž˜μŠ€μ—μ„œ μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ΄ μžλ™μœΌλ‘œ μ‚¬μš©λ¨μ„ κ³„μ‚°ν•˜κΈ°
  2. μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ΄ κΉ¨μ–΄λ‚  λ•Œ μ• ν”Œλ¦¬μΌ€μ΄μ…˜ ν΄λž˜μŠ€μ—μ„œ λ‘œλ“œλ˜λŠ” 것을 κ³„μ‚°ν•˜κΈ°
  3. 이듀을 ν•˜λ‚˜μ˜ νŒŒμΌμ—, λͺ¨λ‘ λ°”λ₯Έ μˆœμ„œλŒ€λ‘œ ν΄λž˜μŠ€μ™€ ν•¨κ»˜ κ²°ν•©ν•˜κΈ°
  4. JSDoc의 μ½”λ©˜νŠΈλ₯Ό λͺ¨λ‘ 제거, 파일이 κ°€λŠ₯ν•œ μž‘μ•„μ§€κ²Œ μΆ•μ†Œ

SDK 도ꡬ μ„€μΉ˜ν•˜κΈ°

μ„Όμ°¨ SDK 도ꡬ가 μ„€μΉ˜λ˜μ§€ μ•Šμ€ 경우, λΉŒλ“œλ₯Ό μƒμ„±ν•˜κΈ° 전에 μ„€μΉ˜ λ˜μ–΄ μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€. 도ꡬ가 이미 μ„€μΉ˜λ˜μ–΄ μžˆλŠ”μ§€ ν™•μΈν•˜λŠ” λΉ λ₯Έ 방법은 μ»€λ§¨λ“œ 라인 터미널을 μ—΄κ³  'sencha' λ₯Ό μž…λ ₯ν•©λ‹ˆλ‹€ - SDK 도ꡬ가 μ‘΄μž¬ν•œλ‹€λ©΄ μ΄λ ‡κ²Œ λ‚˜νƒ€λ‚©λ‹ˆλ‹€ :

1

SDK 도ꡬ가 μ„€μΉ˜λœ 경우 μ»€λ§¨λ“œ λΌμΈμ—μ„œ 'sencha'κ°€ μ‹€ν–‰ 쀑 μž„μ„ 좜λ ₯

였λ₯˜κ°€ μžˆλ‹€λ©΄ μ•„λ§ˆλ„ λŒ€κ²Œ SDK 도ꡬ가 μ„€μΉ˜λ˜μ–΄ μžˆμ§€ μ•Šμ€ 것 μž…λ‹ˆλ‹€. κ·Έλƒ₯ http://www.sencha.com/products/sdk-toolsμ—μ„œ λ‹€μš΄λ‘œλ“œ λ²„νŠΌμ„ λˆ„λ₯΄κ³  λ‹€μš΄λ‘œλ“œν•œ νŒŒμΌμ„ λ”λΈ”ν΄λ¦­ν•˜λ©΄ λ‹€μ‹œ μ„Όμ°¨ μ„€μΉ˜ λͺ…령을 μ‹œλ„ν•œ ν›„ λͺ¨λ‘ μž‘λ™ν• κ²ƒμž…λ‹ˆλ‹€.

λΉŒλ“œ μƒμ„±ν•˜κΈ°

** μ°Έμ‘°: ** λΉŒλ“œ 단계 λ‹€μŒ 릴리즈 (2.0.0 베타 2)μ—μ„œ λ‹¨μˆœν•˜κ²Œ μ˜ˆμ •λœ 것도 릴리즈λ₯Ό μ‚¬μš©ν•  수 μžˆλŠ”μ§€ λ‹€μ‹œ ν•œ 번 νŽ˜μ΄μ§€λ₯Ό ν™•μΈν•˜μ‹œκΈ° λ°”λžλ‹ˆλ‹€.

이미 둜컬둜 μž‘λ™ν•˜λŠ” 앱을 κ°€μ§€κ³  있으며 μ œμž‘ν•˜λŠ” μˆœκ°„μ„ μœ„ν•΄ λΉŒλ“œν•˜κΈΈ μ›ν•œλ‹€κ³  κ°€μ •ν•©λ‹ˆλ‹€. 이에 λŒ€ν•΄ 무엇인지 λͺ¨λ₯΄κ±°λ‚˜ 아직 앱이 μ—†λ‹€λ©΄, μ‹œμž‘ κ°€μ΄λ“œλ₯Ό 확인 ν•˜μ‹­μ‹œμš”.

앱이 둜컬인 κ²ƒμ²˜λŸΌ κ°€μ •ν•˜μ—¬, μ§„ν–‰ν•©μ‹œλ‹€. μ–΄λ–»κ²Œ μž‘λ™ν•˜λŠ”μ§€ μ„€λͺ…μœΌλ‘œ Sencha ν„°μΉ˜ SDK와 ν•¨κ»˜ μ œκ³΅λ˜λŠ” νŠΈμœ„ν„° 예제λ₯Ό μ‚¬μš© ν•  것 μž…λ‹ˆλ‹€. 첫번째둜 index.html νŽ˜μ΄μ§€ 파일과 ν•¨κ»˜ 슀슀둜 μ΅μˆ™ν•΄ μ§‘μ‹œλ‹€:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Twitter</title>

    <link rel="stylesheet" href="resources/css/application.css" type="text/css">

    <script type="text/javascript" src="touch/sencha-touch-debug.js"></script>
    <script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>

sencha - ν„°μΉ˜ debug.js 및 app.js을 λ‘œλ“œν•˜κ³  μžˆλŠ”μ§€ 주의 - 이 쑰합은 앱을 κ°œλ°œν•˜λ©΄μ„œ λ™μ λ‘œλ“œλ₯Ό μ‚¬μš©ν•  수 있게 ν•΄ μ£ΌλŠ” 것이며, 그리고 μ΅œμ†Œν•œμ˜ λΉŒλ“œλ₯Ό μƒμ„±ν•˜κΈ°μœ„ν•œ SDK 도ꡬ λŠ₯λ ₯의 κΈ°μ΄ˆμž…λ‹ˆλ‹€. κ³§ μ΄λŸ¬ν•œ HTML 파일의 λ‚΄μš©μœΌλ‘œ λŒμ•„μ˜¬ κ²ƒμž…λ‹ˆλ‹€.

μ»€λ§¨λ“œλΌμΈμœΌλ‘œ λŒμ•„κ°€μ„œ - cd의 λ””ν…ν† λ¦¬λ‘œ ν•˜λ“œ λ“œλΌμ΄λΈŒμ— 앱을 λ¨Όμ € μ°Ύμ•„μ•Ό ν•©λ‹ˆλ‹€ :

cd ~/path/to/my/app

λ‹€μŒμ€ 앱을 μœ„ν•œ jsb νŒŒμΌμ„ μƒμ„±ν•΄μ•Όν•©λ‹ˆλ‹€. jsb νŒŒμΌμ€ 기본적으둜 μ•±μ—μ„œ μ‚¬μš©ν•˜λŠ” λͺ¨λ“  클래슀의 λͺ©λ‘μž…λ‹ˆλ‹€. λ‹€ν–‰νžˆ, SDK λ„κ΅¬λ‘œ λ‹€μŒμ„ μˆ˜ν–‰ν•©λ‹ˆλ‹€ :

sencha create jsb -a index.html -p app.jsb3

이 λͺ…령은 index.html 파일 (앱을 κ°œλ°œν•˜λ©΄μ„œ λΈŒλΌμš°μ €μ—μ„œ μ‚¬μš©ν•˜λŠ” λ™μΌν•œ 파일)을 κ°€μ Έκ°€κ³ , 호좜된 app.jsb3 νŒŒμΌμ„ μž‘μ„±ν•˜κ³  μ „λΆ€ κ·Έ 클래슀 μ’…μ†μœΌλ‘œ μ΄ν•΄ν•©λ‹ˆλ‹€ :

sencha build -p app.jsb3 -d ./

μ΅œμ’… λͺ…령은 jsb에 λ‚˜μ—΄λœ λͺ¨λ“  νŒŒμΌμ„ μ†Œμš”ν•˜κ³  λ‚˜μ„œ μ΅œλŒ€ν•œ μž‘κ²Œ λ§Œλ“€κΈ° μœ„ν•΄ μΆ•μ†Œλœ ν•˜λ‚˜μ˜ νŒŒμΌμ— κ²°ν•© ν•©λ‹ˆλ‹€. ν”„λ ˆμž„μ›Œν¬ 클래슀 외에 μ‘μš© ν”„λ‘œκ·Έλž¨ 클래슀λ₯Ό λͺ¨λ‘ ν¬ν•¨ν•˜λŠ” classes.jsλΌλŠ” νŒŒμΌμ„ 좜λ ₯ν•©λ‹ˆλ‹€.

HTML νŒŒμΌμ„ μ—…λ°μ΄νŠΈν•˜κΈ°

λ§ˆμ§€λ§‰ λ‹¨κ³„λŠ” μ•± μ œμž‘μ— λŒ€ν•œ sencha-touch-debug.js의 sencha-touch.jsλ₯Ό λŒ€μ‹  μ‚¬μš©ν•˜κ³  λͺ¨λ“  classes.jsλ₯Ό μƒˆλ‘œ μƒμ„±ν•˜μ—¬ λ‘œλ“œν•˜λŠ” HTML 파일의 μ—…λ°μ΄νŠΈλ₯Ό μ€€λΉ„ν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€. νŠΈμœ„ν„° 예제 νŒŒμΌμ„ 마무리 ν•˜λŠ” 방법은 λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Twitter</title>

    <link rel="stylesheet" href="resources/css/application.css" type="text/css">

    <script type="text/javascript" src="touch/sencha-touch.js"></script>
	<script type="text/javascript" src="all-classes.js"></script>
    <script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>

메인 index.html νŽ˜μ΄μ§€ νŒŒμΌμ„ λ‚΄λ‚΄ λ³€κ²½ ν•˜κΈ°λ³΄λ‹€, μœ„μ˜ 파일과 λΉ„μŠ·ν•œ index-production.html이 ν˜ΈμΆœλ˜λŠ” 사본을 λ§Œλ“œλŠ” 것이 μΌλ°˜μ μž…λ‹ˆλ‹€. λ§Žμ€ κ°œλ°œμžλ“€μ€ μžλ™μ μœΌλ‘œ κ·Έλ ‡κ²Œ λΉŒλ“œλ₯Ό κ°„λ‹¨ν•˜κ²Œ 올릴 수 μžˆλŠ” index.html에 λ°°ν¬ν•˜λŠ” 폴더와 이름을 λ°”κΏ‰λ‹ˆλ‹€ index-production.html둜 μ‘μš© ν”„λ‘œκ·Έλž¨μ„ λ³΅μ‚¬ν•˜λŠ” κ°„λ‹¨ν•œ 배치 슀크립트λ₯Ό μž‘μ„±ν•  κ²ƒμž…λ‹ˆλ‹€.

μž‘μ„±μžμ—κ²Œ λ‹€κ°€μ˜¬ λ³€ν™”

단 λͺ‡ κ±ΈμŒμ΄μ§€λ§Œ, μš°λ¦¬λŠ” μ›Œν¬ν”Œλ‘œμš°μ™€ μ„Όμ°¨ν„°μΉ˜μ˜ λ‹€μŒ 릴리슀λ₯Ό μœ„ν•œ λΉŒλ”μ˜ 좜λ ₯을 λͺ¨λ‘ κ°œμ„ ν•˜κ³  μ‹ΆμŠ΅λ‹ˆλ‹€. μ„Όμ°¨ν„°μΉ˜ 2.0 베타 1을 μ‚¬μš©ν•˜μ—¬ κ΅¬μΆ•ν•˜λŠ” κ²½μš°μ—λŠ” κ·Έ κ°€λŠ₯성이 μžˆλŠ” 단계이며, 좜λ ₯이 μ•½κ°„ λ³€κ²½λ˜λŠ”λŒ€λ‘œ λ‚˜μ€‘μ— 릴리슀λ₯Ό μ—…κ·Έλ ˆμ΄λ“œν•˜λ©΄ λ‹€μ‹œ 확인해 μ£Όμ‹œκΈ° λ°”λžλ‹ˆλ‹€.

⚠️ **GitHub.com Fallback** ⚠️