Compiling CSS and JavaScript

2014. 9. 2. 11:52EXPERIENCE/WEB | Bootstrap

반응형

Compiling CSS and JavaScript

Bootstrap uses Grunt for its build system, with convenient methods for working with the framework. It's how we compile our code, run tests, and more.

bootstrap은 프레임워크 동작의 편리를 위해 Grunt 의 빌드시스템을 사용한다. 아래는, 우리가 어떻게 코드를 컴파일하고, 테스트와 기타 외작업을 어떻게 하는지 설명한다. 

Installing Grunt

To install Grunt, you must first download and install node.js (which includes npm). npm stands for node packaged modules and is a way to manage development dependencies through node.js.

Then, from the command line:

  1. Install grunt-cli globally with npm install -g grunt-cli.
  2. Navigate to the root /bootstrap/ directory, then run npm install. npm will look at the package.json file and automatically install the necessary local dependencies listed there.

When completed, you'll be able to run the various Grunt commands provided from the command line.


Grunt 설치하기

Grunt 설치하기 위해서는, 먼저 node.js를 다운받는다.(npm이 포함되어 있는). npm은 node packaged modules 과 node.js를 개발 독립적으로 관리하는 방법이다. 

command line에 작성한다 :  
1.  grunt-cli 을 

Available Grunt commands

grunt dist (Just compile CSS and JavaScript)

Regenerates the /dist/ directory with compiled and minified CSS and JavaScript files. As a Bootstrap user, this is normally the command you want.

grunt watch (Watch)

Watches the Less source files and automatically recompiles them to CSS whenever you save a change.

grunt test (Run tests)

Runs JSHint and runs the QUnit tests headlessly in PhantomJS.

grunt (Build absolutely everything and run tests)

Compiles and minifies CSS and JavaScript, builds the documentation website, runs the HTML5 validator against the docs, regenerates the Customizer assets, and more. Usually only necessary if you're hacking on Bootstrap itself.

Troubleshooting

Should you encounter problems with installing dependencies or running Grunt commands, first delete the /node_modules/ directory generated by npm. Then, rerun npm install.

반응형

'EXPERIENCE > WEB | Bootstrap' 카테고리의 다른 글

GRUNT : The JavaScript Task Runner  (0) 2014.09.02