Giter VIP home page Giter VIP logo

grunt-requirejs-exam's Introduction

grunt-requirejs-exam

grunt와 AMD 방식중 하나인 requireJS 를 연동하는 Example

#준비과정 grunt에서 제공하는 grunt-contrib-requirejs 를 설치한다.(npm 필수)

npm install grunt-contrib-requirejs --save-dev

Gruntfile.js 에 다음과 같이 load 한다.

grunt.loadNpmTasks('grunt-contrib-requirejs');

#기본구조 GruntFile.js 참고

requirejs:{
 compile:{
  options: {
   // 다양한 (?) 옵션을 설정할 수 있다.
  }
 }
}

##options ###baseUrl options에서 사용할 dir root를 잡는 것 (requirejs랑 같다.) ###mainConfigFile GruntFile.js 에서 requirejs config를 할 수 있지만, 재사용성과 , require.config()를 로드 하는 위치를 설정 한다. ###name modules이나 includes할 것에 대한 정의를 하거나, config를 load 할 수 있게 해준다( 확실 하지 않음...) name을 정의하지않는다면 꼭 modules이나 includes를 해야한다. ###out output의 JS가 나오는 dir ###empty: library 들은 굳이 optimize 할 필요 없기 때문에 'empty:' 키워드로 제외 시킬 수 있다.

##grunt running 하기 이제 running 하기 위한 키워드이다.

grunt requirejs

####예제 링크 http://58.227.42.221:14001

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.