SlideShare a Scribd company logo
1 of 15
Download to read offline
Grunt
손 찬 욱
Grunt 의미
The JavaScript
Task Runner
자동화 툴?
왜? Grunt를 발표하는가?
“최소의 노력으로 어떤 것이든 자동화 할 수 있다.”
1. Descriptive language
2. Programing (nodejs)
3. 많은 플러그인 제공 (javascirpt,css)
4. 쉬운 플러그인 제작과 배포
5. Scaffolding 제공
Grunt Project
Grunt-cli
라이브러리 의존성 관리
grunt Gruntfile.js
NPM package.json
watch uglify jshint concat …
자동화
Grunt-init
scaffollding
From NPM
Grunt 맛보기 (데모)
1. Grunt 설치
npm install –g grunt-cli
npm install –g grunt-init
2. Jquery-plugin 기반 Project 생성
git clone https://github.com/gruntjs/grunt-init-jquery.git ~/.grunt-init/jquery
(http://gruntjs.com/installing-grunt)
Nodejs >= 0.8.0 이상 설치
(http://gruntjs.com/project-scaffolding)
4. Grunt 사용하기
grunt
3. Jquery-plugin 기반 Project 생성
grunt-init jquery
npm install // 관련 모듈 다운로드
Grunt 사용하기
• grunt를 파라미터로 받는 모듈에서
grunt.initConfig를 통해 설정.
• Task 밑에 target으로 구성
• Task 외에 별도 property 지정가능
• Target은 src,dest 로 구성됨
• Target의 src,dest는 다양한 방식으로
지정가능함.
• Task와 target은 옵션을 가질 수 있음
• 프로그래밍을 통해 외부데이터를
import 할 수 있음
• 템플릿 (<%=%>)을 사용하여 설정 값
을 참고할 수 있음
• task를 loadNpmTasks를 통해 로드
• registerTask를 통해 사용자 Task등록
(Task 만들기 부분 참조)
1. Gruntfile.js 설정
Grunt 사용하기
grunt [task:target] [task:target] …
• Grunt만 실행 했을 경우, default task가 실행됨
grunt
• 특정 task의 target을 실행할 수 있음.
grunt qunit:tar1 qunit:tar2
• Task 만 지정하였을 경우, 모든 target이 순차적으로 실행됨
grung qunit
• 다수의 task를 한 번에 실행 할 수 있음
grunt qunit concat uglify
2. Grunt 실행
Grunt 사용하기
grunt.registerTask(taskname, [description], tasklist/taskfunction);
• resisterTask는 alias 작업을 등록할 수 있다.
grunt.registerTask(“dist”, [“jshint”, “qunit”]);
-> grunt dist
• resisterTask는 기본 작업을 등록할 수 있다.
(Gruntfile.js 와 상관 없이 작업)
-> grunt start:가:a
3. Grunt task 만들기 - 1 (resisterTask)
Grunt 사용하기
grunt.registerMultiTask(taskname, [description], taskfunction);
• registerMultiTask로 사용자 작업을 등록할 수 있다.
-> grunt log:foo
grunt log
4. Grunt task 만들기 - 2 (resisterMultiTask)
Grunt 실사용 예
• grunt jshint를 이용한 javascript 정적 검사
• grunt qunit을 이용한 테스트 케이스 검사
• grunt watch를 이용한 실시간 테스트 개발하기
• grunt concat을 이용한 javascript 파일 합쳐 배포 파일 만들기
• grunt uglify를 이용한 javascript 배포 파일 압축하기
실 예제 데모
정리
“최소의 노력으로 어떤 것이든 자동화 할 수 있다.”
1. Descriptive language
2. Programing (nodejs)
3. 많은 플러그인 제공
4. 쉬운 플러그인 제작과 배포
5. Scaffolding 제공
Q & A
질문 있으신가요?
FAQ
2. Npm 템플릿은 직접 만들어 배포할 수 있나요?
http://gruntjs.com/project-scaffolding#custom-templates
1. Npm 플러그인은 직접 만들어 배포할 수 있나요?
http://gruntjs.com/creating-plugins
3. Npmjs.org에 있는 플러그인만 사용해야 하나요?
https://github.com/isaacs/npmjs.org
Gruntjs

More Related Content

What's hot

Git 과 GitHub 를 이용한 버전관리와 협업 - 1주차 - 첫 커밋 푸시하기
Git 과 GitHub 를 이용한 버전관리와 협업 - 1주차 - 첫 커밋 푸시하기Git 과 GitHub 를 이용한 버전관리와 협업 - 1주차 - 첫 커밋 푸시하기
Git 과 GitHub 를 이용한 버전관리와 협업 - 1주차 - 첫 커밋 푸시하기Youngbin Han
 
Windows에서 go+eclipse 개발환경 구축
Windows에서 go+eclipse 개발환경 구축Windows에서 go+eclipse 개발환경 구축
Windows에서 go+eclipse 개발환경 구축Jaehoon Kim
 
Git 사용법 공유 + Unity3D with git
Git 사용법 공유 + Unity3D with gitGit 사용법 공유 + Unity3D with git
Git 사용법 공유 + Unity3D with gitSeongSik Kim
 
OpenCV 에서 OpenCL 살짝 써보기
OpenCV 에서 OpenCL 살짝 써보기OpenCV 에서 OpenCL 살짝 써보기
OpenCV 에서 OpenCL 살짝 써보기Seunghwa Song
 
버전관리시스템 종류와 소개
버전관리시스템 종류와 소개버전관리시스템 종류와 소개
버전관리시스템 종류와 소개Jong-il Seok
 
리눅스 커널 디버거 KGDB/KDB
리눅스 커널 디버거 KGDB/KDB리눅스 커널 디버거 KGDB/KDB
리눅스 커널 디버거 KGDB/KDBManjong Han
 
Git 더하기 GitHub(Git클라이언트 활용) / Getting started with git+github
Git 더하기 GitHub(Git클라이언트 활용) / Getting started with git+githubGit 더하기 GitHub(Git클라이언트 활용) / Getting started with git+github
Git 더하기 GitHub(Git클라이언트 활용) / Getting started with git+githubJunyoung Lee
 
Nodejs발표자료 - 팀 세미나용
Nodejs발표자료 - 팀 세미나용 Nodejs발표자료 - 팀 세미나용
Nodejs발표자료 - 팀 세미나용 SuHyun Jeon
 
버전관리를 들어본적 없는 사람들을 위한 DVCS - Git
버전관리를 들어본적 없는 사람들을 위한 DVCS - Git버전관리를 들어본적 없는 사람들을 위한 DVCS - Git
버전관리를 들어본적 없는 사람들을 위한 DVCS - Git민태 김
 
Hackers 퍼블리시팀 Git
Hackers 퍼블리시팀 GitHackers 퍼블리시팀 Git
Hackers 퍼블리시팀 GitWasabi-Jin
 
[5분 따라하기] git으로 undo하기(local편)
[5분 따라하기] git으로 undo하기(local편)[5분 따라하기] git으로 undo하기(local편)
[5분 따라하기] git으로 undo하기(local편)Jay Park
 
Git이란 (Git 소개 및 기초 이론)
Git이란 (Git 소개 및 기초 이론)Git이란 (Git 소개 및 기초 이론)
Git이란 (Git 소개 및 기초 이론)승용 윤
 
[NDC16] Effective Git
[NDC16] Effective Git[NDC16] Effective Git
[NDC16] Effective GitChanwoong Kim
 
Git+, Git 조금 더 배워보기
Git+, Git 조금 더 배워보기Git+, Git 조금 더 배워보기
Git+, Git 조금 더 배워보기현진 김
 
Node.js 현재와 미래
Node.js 현재와 미래Node.js 현재와 미래
Node.js 현재와 미래JeongHun Byeon
 
[2019] '깃'깔나는 Git 워크플로 알아보기
[2019] '깃'깔나는 Git 워크플로 알아보기[2019] '깃'깔나는 Git 워크플로 알아보기
[2019] '깃'깔나는 Git 워크플로 알아보기NHN FORWARD
 
소셜인어스 SVN 도움말
소셜인어스 SVN 도움말소셜인어스 SVN 도움말
소셜인어스 SVN 도움말Insub Lee
 
Git 더하기 GitHub(구름IDE 환경)
Git 더하기 GitHub(구름IDE 환경)Git 더하기 GitHub(구름IDE 환경)
Git 더하기 GitHub(구름IDE 환경)Junyoung Lee
 

What's hot (20)

go-qml
go-qmlgo-qml
go-qml
 
Git 과 GitHub 를 이용한 버전관리와 협업 - 1주차 - 첫 커밋 푸시하기
Git 과 GitHub 를 이용한 버전관리와 협업 - 1주차 - 첫 커밋 푸시하기Git 과 GitHub 를 이용한 버전관리와 협업 - 1주차 - 첫 커밋 푸시하기
Git 과 GitHub 를 이용한 버전관리와 협업 - 1주차 - 첫 커밋 푸시하기
 
Windows에서 go+eclipse 개발환경 구축
Windows에서 go+eclipse 개발환경 구축Windows에서 go+eclipse 개발환경 구축
Windows에서 go+eclipse 개발환경 구축
 
Git 사용법 공유 + Unity3D with git
Git 사용법 공유 + Unity3D with gitGit 사용법 공유 + Unity3D with git
Git 사용법 공유 + Unity3D with git
 
Git Branch
Git BranchGit Branch
Git Branch
 
OpenCV 에서 OpenCL 살짝 써보기
OpenCV 에서 OpenCL 살짝 써보기OpenCV 에서 OpenCL 살짝 써보기
OpenCV 에서 OpenCL 살짝 써보기
 
버전관리시스템 종류와 소개
버전관리시스템 종류와 소개버전관리시스템 종류와 소개
버전관리시스템 종류와 소개
 
리눅스 커널 디버거 KGDB/KDB
리눅스 커널 디버거 KGDB/KDB리눅스 커널 디버거 KGDB/KDB
리눅스 커널 디버거 KGDB/KDB
 
Git 더하기 GitHub(Git클라이언트 활용) / Getting started with git+github
Git 더하기 GitHub(Git클라이언트 활용) / Getting started with git+githubGit 더하기 GitHub(Git클라이언트 활용) / Getting started with git+github
Git 더하기 GitHub(Git클라이언트 활용) / Getting started with git+github
 
Nodejs발표자료 - 팀 세미나용
Nodejs발표자료 - 팀 세미나용 Nodejs발표자료 - 팀 세미나용
Nodejs발표자료 - 팀 세미나용
 
버전관리를 들어본적 없는 사람들을 위한 DVCS - Git
버전관리를 들어본적 없는 사람들을 위한 DVCS - Git버전관리를 들어본적 없는 사람들을 위한 DVCS - Git
버전관리를 들어본적 없는 사람들을 위한 DVCS - Git
 
Hackers 퍼블리시팀 Git
Hackers 퍼블리시팀 GitHackers 퍼블리시팀 Git
Hackers 퍼블리시팀 Git
 
[5분 따라하기] git으로 undo하기(local편)
[5분 따라하기] git으로 undo하기(local편)[5분 따라하기] git으로 undo하기(local편)
[5분 따라하기] git으로 undo하기(local편)
 
Git이란 (Git 소개 및 기초 이론)
Git이란 (Git 소개 및 기초 이론)Git이란 (Git 소개 및 기초 이론)
Git이란 (Git 소개 및 기초 이론)
 
[NDC16] Effective Git
[NDC16] Effective Git[NDC16] Effective Git
[NDC16] Effective Git
 
Git+, Git 조금 더 배워보기
Git+, Git 조금 더 배워보기Git+, Git 조금 더 배워보기
Git+, Git 조금 더 배워보기
 
Node.js 현재와 미래
Node.js 현재와 미래Node.js 현재와 미래
Node.js 현재와 미래
 
[2019] '깃'깔나는 Git 워크플로 알아보기
[2019] '깃'깔나는 Git 워크플로 알아보기[2019] '깃'깔나는 Git 워크플로 알아보기
[2019] '깃'깔나는 Git 워크플로 알아보기
 
소셜인어스 SVN 도움말
소셜인어스 SVN 도움말소셜인어스 SVN 도움말
소셜인어스 SVN 도움말
 
Git 더하기 GitHub(구름IDE 환경)
Git 더하기 GitHub(구름IDE 환경)Git 더하기 GitHub(구름IDE 환경)
Git 더하기 GitHub(구름IDE 환경)
 

Viewers also liked

헨릭빕스코브
헨릭빕스코브헨릭빕스코브
헨릭빕스코브Younseok Seo
 
Key point for day 1 mdp
Key point for day 1 mdpKey point for day 1 mdp
Key point for day 1 mdpAmei Ting
 
Recensione g ray matter
Recensione g ray matterRecensione g ray matter
Recensione g ray matterincantevole
 
200 million reasons to be on LinkedIn
200 million reasons to be on LinkedIn 200 million reasons to be on LinkedIn
200 million reasons to be on LinkedIn The Social Executive
 
Social media strategy for government businesses
Social media strategy for government businessesSocial media strategy for government businesses
Social media strategy for government businessesThe Social Executive
 
Recensione the filmmaker
Recensione the filmmakerRecensione the filmmaker
Recensione the filmmakerincantevole
 
The origin of the Numbers
The origin of the NumbersThe origin of the Numbers
The origin of the Numbersiepie2010
 
Gray matter soluzione completa
Gray matter soluzione completaGray matter soluzione completa
Gray matter soluzione completaincantevole
 
패션스타트업과 함께 한 5월의 D.PARTY_Lounge.F (뷰리플)
패션스타트업과 함께 한 5월의 D.PARTY_Lounge.F (뷰리플) 패션스타트업과 함께 한 5월의 D.PARTY_Lounge.F (뷰리플)
패션스타트업과 함께 한 5월의 D.PARTY_Lounge.F (뷰리플) D.CAMP
 
Putting the customer at centre february 2012
Putting the customer at centre  february 2012Putting the customer at centre  february 2012
Putting the customer at centre february 2012The Social Executive
 
Black Mirror III Soluzione
Black Mirror III SoluzioneBlack Mirror III Soluzione
Black Mirror III Soluzioneincantevole
 
Recensione phobos
Recensione phobosRecensione phobos
Recensione phobosincantevole
 
The next billion consumers will not have lived in a world without social media
The next billion consumers will not have lived in a world without social media The next billion consumers will not have lived in a world without social media
The next billion consumers will not have lived in a world without social media The Social Executive
 

Viewers also liked (20)

헨릭빕스코브
헨릭빕스코브헨릭빕스코브
헨릭빕스코브
 
Phobos cap1
Phobos cap1Phobos cap1
Phobos cap1
 
Zero
ZeroZero
Zero
 
Key point for day 1 mdp
Key point for day 1 mdpKey point for day 1 mdp
Key point for day 1 mdp
 
Recensione g ray matter
Recensione g ray matterRecensione g ray matter
Recensione g ray matter
 
Traduzione
TraduzioneTraduzione
Traduzione
 
200 million reasons to be on LinkedIn
200 million reasons to be on LinkedIn 200 million reasons to be on LinkedIn
200 million reasons to be on LinkedIn
 
Social media strategy for government businesses
Social media strategy for government businessesSocial media strategy for government businesses
Social media strategy for government businesses
 
Ark group australia august 2011
Ark group australia august 2011Ark group australia august 2011
Ark group australia august 2011
 
Recensione the filmmaker
Recensione the filmmakerRecensione the filmmaker
Recensione the filmmaker
 
Ea
EaEa
Ea
 
The origin of the Numbers
The origin of the NumbersThe origin of the Numbers
The origin of the Numbers
 
Vps
VpsVps
Vps
 
Gray matter soluzione completa
Gray matter soluzione completaGray matter soluzione completa
Gray matter soluzione completa
 
패션스타트업과 함께 한 5월의 D.PARTY_Lounge.F (뷰리플)
패션스타트업과 함께 한 5월의 D.PARTY_Lounge.F (뷰리플) 패션스타트업과 함께 한 5월의 D.PARTY_Lounge.F (뷰리플)
패션스타트업과 함께 한 5월의 D.PARTY_Lounge.F (뷰리플)
 
Putting the customer at centre february 2012
Putting the customer at centre  february 2012Putting the customer at centre  february 2012
Putting the customer at centre february 2012
 
Dionne lew libmark
Dionne lew libmarkDionne lew libmark
Dionne lew libmark
 
Black Mirror III Soluzione
Black Mirror III SoluzioneBlack Mirror III Soluzione
Black Mirror III Soluzione
 
Recensione phobos
Recensione phobosRecensione phobos
Recensione phobos
 
The next billion consumers will not have lived in a world without social media
The next billion consumers will not have lived in a world without social media The next billion consumers will not have lived in a world without social media
The next billion consumers will not have lived in a world without social media
 

Similar to Gruntjs

Jenkins를 활용한 javascript 개발
Jenkins를 활용한 javascript 개발Jenkins를 활용한 javascript 개발
Jenkins를 활용한 javascript 개발지수 윤
 
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기현철 조
 
AngularJS In Production
AngularJS In ProductionAngularJS In Production
AngularJS In ProductionMooYeol Lee
 
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축Ji-Woong Choi
 
Node.js 팀 스터디 발표자료.
Node.js 팀 스터디 발표자료.Node.js 팀 스터디 발표자료.
Node.js 팀 스터디 발표자료.SeungWoo Lee
 
postgres_빌드_및_디버깅.pdf
postgres_빌드_및_디버깅.pdfpostgres_빌드_및_디버깅.pdf
postgres_빌드_및_디버깅.pdfLee Dong Wook
 
TestExplorer 소개 - Android application GUI testing tool
TestExplorer 소개 - Android application GUI testing toolTestExplorer 소개 - Android application GUI testing tool
TestExplorer 소개 - Android application GUI testing toolhyunae lee
 
TestExplorer 소개 - Android application GUI testing tool
TestExplorer 소개 - Android application GUI testing toolTestExplorer 소개 - Android application GUI testing tool
TestExplorer 소개 - Android application GUI testing toolhyunae lee
 
Introduction to node.js, npm and grunt
Introduction to node.js, npm and gruntIntroduction to node.js, npm and grunt
Introduction to node.js, npm and gruntJaecheol Lee
 
소셜게임 서버 개발 관점에서 본 Node.js의 장단점과 대안
소셜게임 서버 개발 관점에서 본 Node.js의 장단점과 대안소셜게임 서버 개발 관점에서 본 Node.js의 장단점과 대안
소셜게임 서버 개발 관점에서 본 Node.js의 장단점과 대안Jeongsang Baek
 
20160420 ROS 3차 강의 (for 아스라다 팀)
20160420 ROS 3차 강의 (for 아스라다 팀)20160420 ROS 3차 강의 (for 아스라다 팀)
20160420 ROS 3차 강의 (for 아스라다 팀)Yoonseok Pyo
 
Web Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons Learned
Web Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons LearnedWeb Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons Learned
Web Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons LearnedJungsu Heo
 
Introduce Yeoman
Introduce YeomanIntroduce Yeoman
Introduce Yeoman항희 이
 
16. Install - Nutch
16. Install - Nutch16. Install - Nutch
16. Install - Nutchmerry7
 
Node.js의 도입과 활용
Node.js의 도입과 활용Node.js의 도입과 활용
Node.js의 도입과 활용Jin wook
 
Fluentd with MySQL
Fluentd with MySQLFluentd with MySQL
Fluentd with MySQLI Goo Lee
 
Node.js 살펴보기
Node.js 살펴보기Node.js 살펴보기
Node.js 살펴보기명신 김
 

Similar to Gruntjs (20)

How to Grunt.js
How to Grunt.jsHow to Grunt.js
How to Grunt.js
 
Jenkins를 활용한 javascript 개발
Jenkins를 활용한 javascript 개발Jenkins를 활용한 javascript 개발
Jenkins를 활용한 javascript 개발
 
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
[NDC17] Unreal.js - 자바스크립트로 쉽고 빠른 UE4 개발하기
 
AngularJS In Production
AngularJS In ProductionAngularJS In Production
AngularJS In Production
 
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
 
Node.js 팀 스터디 발표자료.
Node.js 팀 스터디 발표자료.Node.js 팀 스터디 발표자료.
Node.js 팀 스터디 발표자료.
 
postgres_빌드_및_디버깅.pdf
postgres_빌드_및_디버깅.pdfpostgres_빌드_및_디버깅.pdf
postgres_빌드_및_디버깅.pdf
 
TestExplorer 소개 - Android application GUI testing tool
TestExplorer 소개 - Android application GUI testing toolTestExplorer 소개 - Android application GUI testing tool
TestExplorer 소개 - Android application GUI testing tool
 
TestExplorer 소개 - Android application GUI testing tool
TestExplorer 소개 - Android application GUI testing toolTestExplorer 소개 - Android application GUI testing tool
TestExplorer 소개 - Android application GUI testing tool
 
Gcd ppt
Gcd pptGcd ppt
Gcd ppt
 
Introduction to node.js, npm and grunt
Introduction to node.js, npm and gruntIntroduction to node.js, npm and grunt
Introduction to node.js, npm and grunt
 
소셜게임 서버 개발 관점에서 본 Node.js의 장단점과 대안
소셜게임 서버 개발 관점에서 본 Node.js의 장단점과 대안소셜게임 서버 개발 관점에서 본 Node.js의 장단점과 대안
소셜게임 서버 개발 관점에서 본 Node.js의 장단점과 대안
 
20160420 ROS 3차 강의 (for 아스라다 팀)
20160420 ROS 3차 강의 (for 아스라다 팀)20160420 ROS 3차 강의 (for 아스라다 팀)
20160420 ROS 3차 강의 (for 아스라다 팀)
 
Web Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons Learned
Web Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons LearnedWeb Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons Learned
Web Analytics at Scale with Elasticsearch @ naver.com - Part 2 - Lessons Learned
 
Introduce Yeoman
Introduce YeomanIntroduce Yeoman
Introduce Yeoman
 
16. Install - Nutch
16. Install - Nutch16. Install - Nutch
16. Install - Nutch
 
Node.js 기본
Node.js 기본Node.js 기본
Node.js 기본
 
Node.js의 도입과 활용
Node.js의 도입과 활용Node.js의 도입과 활용
Node.js의 도입과 활용
 
Fluentd with MySQL
Fluentd with MySQLFluentd with MySQL
Fluentd with MySQL
 
Node.js 살펴보기
Node.js 살펴보기Node.js 살펴보기
Node.js 살펴보기
 

Gruntjs

  • 4. 왜? Grunt를 발표하는가? “최소의 노력으로 어떤 것이든 자동화 할 수 있다.” 1. Descriptive language 2. Programing (nodejs) 3. 많은 플러그인 제공 (javascirpt,css) 4. 쉬운 플러그인 제작과 배포 5. Scaffolding 제공
  • 5. Grunt Project Grunt-cli 라이브러리 의존성 관리 grunt Gruntfile.js NPM package.json watch uglify jshint concat … 자동화 Grunt-init scaffollding From NPM
  • 6. Grunt 맛보기 (데모) 1. Grunt 설치 npm install –g grunt-cli npm install –g grunt-init 2. Jquery-plugin 기반 Project 생성 git clone https://github.com/gruntjs/grunt-init-jquery.git ~/.grunt-init/jquery (http://gruntjs.com/installing-grunt) Nodejs >= 0.8.0 이상 설치 (http://gruntjs.com/project-scaffolding) 4. Grunt 사용하기 grunt 3. Jquery-plugin 기반 Project 생성 grunt-init jquery npm install // 관련 모듈 다운로드
  • 7. Grunt 사용하기 • grunt를 파라미터로 받는 모듈에서 grunt.initConfig를 통해 설정. • Task 밑에 target으로 구성 • Task 외에 별도 property 지정가능 • Target은 src,dest 로 구성됨 • Target의 src,dest는 다양한 방식으로 지정가능함. • Task와 target은 옵션을 가질 수 있음 • 프로그래밍을 통해 외부데이터를 import 할 수 있음 • 템플릿 (<%=%>)을 사용하여 설정 값 을 참고할 수 있음 • task를 loadNpmTasks를 통해 로드 • registerTask를 통해 사용자 Task등록 (Task 만들기 부분 참조) 1. Gruntfile.js 설정
  • 8. Grunt 사용하기 grunt [task:target] [task:target] … • Grunt만 실행 했을 경우, default task가 실행됨 grunt • 특정 task의 target을 실행할 수 있음. grunt qunit:tar1 qunit:tar2 • Task 만 지정하였을 경우, 모든 target이 순차적으로 실행됨 grung qunit • 다수의 task를 한 번에 실행 할 수 있음 grunt qunit concat uglify 2. Grunt 실행
  • 9. Grunt 사용하기 grunt.registerTask(taskname, [description], tasklist/taskfunction); • resisterTask는 alias 작업을 등록할 수 있다. grunt.registerTask(“dist”, [“jshint”, “qunit”]); -> grunt dist • resisterTask는 기본 작업을 등록할 수 있다. (Gruntfile.js 와 상관 없이 작업) -> grunt start:가:a 3. Grunt task 만들기 - 1 (resisterTask)
  • 10. Grunt 사용하기 grunt.registerMultiTask(taskname, [description], taskfunction); • registerMultiTask로 사용자 작업을 등록할 수 있다. -> grunt log:foo grunt log 4. Grunt task 만들기 - 2 (resisterMultiTask)
  • 11. Grunt 실사용 예 • grunt jshint를 이용한 javascript 정적 검사 • grunt qunit을 이용한 테스트 케이스 검사 • grunt watch를 이용한 실시간 테스트 개발하기 • grunt concat을 이용한 javascript 파일 합쳐 배포 파일 만들기 • grunt uglify를 이용한 javascript 배포 파일 압축하기 실 예제 데모
  • 12. 정리 “최소의 노력으로 어떤 것이든 자동화 할 수 있다.” 1. Descriptive language 2. Programing (nodejs) 3. 많은 플러그인 제공 4. 쉬운 플러그인 제작과 배포 5. Scaffolding 제공
  • 13. Q & A 질문 있으신가요?
  • 14. FAQ 2. Npm 템플릿은 직접 만들어 배포할 수 있나요? http://gruntjs.com/project-scaffolding#custom-templates 1. Npm 플러그인은 직접 만들어 배포할 수 있나요? http://gruntjs.com/creating-plugins 3. Npmjs.org에 있는 플러그인만 사용해야 하나요? https://github.com/isaacs/npmjs.org