You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

693 lines
16 KiB

11 years ago
11 years ago
Merge branch 'css' of github.com:jlukic/Semantic-UI into css Conflicts: Gruntfile.js build/less/elements/button.less build/less/modules/rating.js build/minified/elements/button.min.css build/minified/modules/rating.js build/minified/modules/rating.min.css build/minified/modules/rating.min.js build/packaged/css/semantic.css.REMOVED.git-id build/packaged/css/semantic.min.css.REMOVED.git-id build/packaged/javascript/semantic.js.REMOVED.git-id build/packaged/javascript/semantic.min.js.REMOVED.git-id build/uncompressed/elements/button.css build/uncompressed/modules/rating.js node/src/files/build/less/elements/button.less node/src/files/build/less/modules/rating.js node/src/files/build/less/modules/rating.less node/src/files/build/minified/elements/button.min.css node/src/files/build/minified/modules/rating.js node/src/files/build/minified/modules/rating.min.css node/src/files/build/minified/modules/rating.min.js node/src/files/build/packaged/css/semantic.css.REMOVED.git-id node/src/files/build/packaged/css/semantic.min.css.REMOVED.git-id node/src/files/build/packaged/javascript/semantic.js.REMOVED.git-id node/src/files/build/packaged/javascript/semantic.min.js.REMOVED.git-id node/src/files/build/semantic.zip.REMOVED.git-id node/src/files/build/uncompressed/elements/button.css node/src/files/build/uncompressed/modules/rating.css node/src/files/build/uncompressed/modules/rating.js rtl/less/elements/button.less rtl/less/modules/rating.js rtl/minified/elements/button.min.css rtl/minified/modules/rating.js rtl/minified/modules/rating.min.css rtl/minified/modules/rating.min.js rtl/packaged/css/semantic.css.REMOVED.git-id rtl/packaged/css/semantic.min.css.REMOVED.git-id rtl/packaged/javascript/semantic.js.REMOVED.git-id rtl/packaged/javascript/semantic.min.js.REMOVED.git-id rtl/uncompressed/elements/button.css rtl/uncompressed/modules/rating.js src/elements/button.less
11 years ago
Merge branch 'css' of github.com:Semantic-Org/Semantic-UI into css Conflicts: build/less/collections/menu.less build/less/elements/button.less build/less/elements/icon.less build/less/elements/input.less build/less/elements/progress.less build/less/modules/accordion.less build/less/modules/checkbox.less build/less/modules/dimmer.less build/less/modules/popup.less build/less/modules/transition.less build/less/semantic.config build/less/themes/github/elements/button.overrides build/less/themes/github/elements/button.variables build/minified/collections/breadcrumb.min.css build/minified/collections/form.min.css build/minified/collections/grid.min.css build/minified/collections/menu.min.css build/minified/collections/message.min.css build/minified/collections/table.min.css build/minified/elements/button.min.css build/minified/elements/divider.min.css build/minified/elements/header.min.css build/minified/elements/icon.min.css build/minified/elements/image.min.css build/minified/elements/input.min.css build/minified/elements/label.min.css build/minified/elements/loader.min.css build/minified/elements/progress.min.css build/minified/elements/reveal.min.css build/minified/elements/segment.min.css build/minified/elements/step.min.css build/minified/modules/accordion.min.css build/minified/modules/chatroom.min.css build/minified/modules/checkbox.min.css build/minified/modules/dimmer.min.css build/minified/modules/dropdown.min.css build/minified/modules/modal.min.css build/minified/modules/nag.min.css build/minified/modules/popup.min.css build/minified/modules/rating.min.css build/minified/modules/search.min.css build/minified/modules/shape.min.css build/minified/modules/sidebar.min.css build/minified/modules/tab.min.css build/minified/modules/transition.min.css build/minified/modules/video.min.css build/minified/themes/github/elements/button.overrides build/minified/themes/github/elements/button.variables build/minified/views/comment.min.css build/minified/views/feed.min.css build/minified/views/item.min.css build/minified/views/list.min.css build/minified/views/statistic.min.css build/packaged/css/semantic.css build/packaged/css/semantic.min.css build/packaged/javascript/semantic.min.js build/packaged/themes/github/elements/button.overrides build/packaged/themes/github/elements/button.variables build/uncompressed/elements/button.css build/uncompressed/elements/header.css build/uncompressed/elements/icon.css build/uncompressed/elements/image.css build/uncompressed/elements/segment.css build/uncompressed/themes/github/elements/button.overrides build/uncompressed/themes/github/elements/button.variables rtl/less/collections/menu.less rtl/less/elements/basic.icon.less rtl/less/elements/button.less rtl/less/elements/icon.less rtl/less/elements/input.less rtl/less/elements/segment.less rtl/less/modules/accordion.less rtl/less/modules/checkbox.less rtl/less/modules/dimmer.less rtl/less/modules/dropdown.less rtl/less/modules/popup.less rtl/less/modules/transition.less rtl/minified/collections/breadcrumb.min.css rtl/minified/collections/form.min.css rtl/minified/collections/grid.min.css rtl/minified/collections/menu.min.css rtl/minified/collections/message.min.css rtl/minified/collections/table.min.css rtl/minified/elements/basic.icon.min.css rtl/minified/elements/button.min.css rtl/minified/elements/divider.min.css rtl/minified/elements/header.min.css rtl/minified/elements/icon.min.css rtl/minified/elements/image.min.css rtl/minified/elements/input.min.css rtl/minified/elements/label.min.css rtl/minified/elements/loader.min.css rtl/minified/elements/progress.min.css rtl/minified/elements/reveal.min.css rtl/minified/elements/segment.min.css rtl/minified/elements/step.min.css rtl/minified/modules/accordion.min.css rtl/minified/modules/chatroom.min.css rtl/minified/modules/checkbox.min.css rtl/minified/modules/dimmer.min.css rtl/minified/modules/dropdown.min.css rtl/minified/modules/modal.min.css rtl/minified/modules/nag.min.css rtl/minified/modules/popup.min.css rtl/minified/modules/rating.min.css rtl/minified/modules/search.min.css rtl/minified/modules/shape.min.css rtl/minified/modules/sidebar.min.css rtl/minified/modules/tab.min.css rtl/minified/modules/transition.min.css rtl/minified/modules/video.min.css rtl/minified/views/comment.min.css rtl/minified/views/feed.min.css rtl/minified/views/item.min.css rtl/minified/views/list.min.css rtl/minified/views/statistic.min.css rtl/packaged/css/semantic.css rtl/packaged/css/semantic.min.css rtl/packaged/javascript/semantic.min.js rtl/uncompressed/elements/basic.icon.css rtl/uncompressed/elements/icon.css server/files/stylesheets/library/basic.icon.css src/elements/icon.less
11 years ago
11 years ago
11 years ago
11 years ago
  1. module.exports = function(grunt) {
  2. var
  3. defaultTasks = [
  4. // run grunt watch
  5. 'watch'
  6. ],
  7. watchTasks = [
  8. // compiles less to docs
  9. 'less:buildDocsCSS',
  10. // auto prefix doc files
  11. 'autoprefixer:prefixFile',
  12. // copies assets and js over to docs
  13. 'copy:srcToDocs',
  14. 'copy:themesToDocs',
  15. // copies examples over to docs
  16. 'copy:examplesToDocs',
  17. // create concatenated css release
  18. 'concat:createDocsCSSPackage',
  19. // create concatenated js release
  20. 'concat:createDocsJSPackage'
  21. ],
  22. testWatchTasks = [
  23. 'clear',
  24. 'karma:watch:run'
  25. ],
  26. testTasks = [
  27. // compiles less to docs so phantomjs can read
  28. 'less:buildTestCSS',
  29. // test components
  30. 'karma:travis'
  31. ],
  32. resetTasks = [
  33. // clean build directory
  34. 'clean:build',
  35. // cleans previous generated release
  36. 'clean:release'
  37. ],
  38. releaseTasks = [
  39. // clean build directory
  40. 'clean:build',
  41. // copies assets and js over to build dir
  42. 'copy:srcToBuild',
  43. // compiles less
  44. 'less:buildCSS',
  45. // auto prefix docs files
  46. 'autoprefixer:prefixDocs',
  47. // auto prefix build files
  48. 'autoprefixer:prefixBuild',
  49. // creates minified js of each file
  50. 'uglify:minifyJS',
  51. // creates minified css of each file
  52. 'cssmin:minifyCSS',
  53. // create concatenated css release
  54. 'concat:createCSSPackage',
  55. // create concatenated js release
  56. 'concat:createJSPackage',
  57. // creates release js of all together
  58. 'uglify:createMinJSPackage',
  59. // creates custom license in header
  60. 'cssmin:createMinCSSPackage',
  61. // cleans previous generated release
  62. 'clean:release'
  63. ],
  64. rtlTasks = [
  65. // copies assets to rtl
  66. 'copy:buildToRTL',
  67. // create rtl release
  68. 'cssjanus:rtl'
  69. ],
  70. docTasks = [
  71. // copies examples over to docs
  72. 'copy:examplesToDocs',
  73. // creates release zip
  74. 'compress:everything',
  75. // copies files over to docs
  76. 'copy:buildToDocs',
  77. // generate code docs
  78. 'docco:generate',
  79. // copies spec files over to docs
  80. 'copy:specToDocs'
  81. ],
  82. outputTasks = [
  83. // compiles less to docs
  84. 'less:outputCSS',
  85. // auto prefix doc files
  86. 'autoprefixer:prefixOutput',
  87. // copies assets and js over to docs
  88. 'copy:outputAssets',
  89. ],
  90. type = type || 'element',
  91. element = element || 'button',
  92. outputPath = type + 's/' + element,
  93. buildTasks = releaseTasks.concat(rtlTasks).concat(docTasks),
  94. setWatchTests = function(action, filePath) {
  95. var
  96. karmaFiles = grunt.config('karma.watch.files'),
  97. isJavascript = (filePath.search('.js') !== -1),
  98. isModule = (filePath.search('modules/') !== -1),
  99. isSpec = (filePath.search('.spec') !== -1),
  100. specFile = (isSpec)
  101. ? filePath
  102. : filePath
  103. .replace('src/', 'test/')
  104. .replace('.js', '.spec.js')
  105. ;
  106. if(isJavascript && (isSpec || isModule) ) {
  107. karmaFiles.pop();
  108. karmaFiles.push(specFile);
  109. }
  110. },
  111. setWatchFiles = function(action, filePath) {
  112. var
  113. buildPath = filePath.replace('src/', 'docs/build/uncompressed/').replace('less', 'css')
  114. ;
  115. if(filePath.search('.less') !== -1) {
  116. grunt.config('less.buildDocsCSS.src', filePath);
  117. grunt.config('less.buildDocsCSS.dest', buildPath);
  118. grunt.config('autoprefixer.prefixFile.src', buildPath);
  119. }
  120. else {
  121. grunt.config('less.buildDocsCSS.src', 'non/existant/path');
  122. grunt.config('less.buildDocsCSS.dest', 'non/existant/path');
  123. grunt.config('autoprefixer.prefixFile.src', 'non/existant/path');
  124. }
  125. },
  126. // this allows filenames with multiple extensions to be preserved
  127. preserveFileExtensions = function(folder, filename) {
  128. return folder + filename.substring(0, filename.lastIndexOf('.') ) + '.css';
  129. },
  130. preserveMinFileExtensions = function(folder, filename) {
  131. return folder + filename.substring(0, filename.lastIndexOf('.') ) + '.min.css';
  132. },
  133. config
  134. ;
  135. config = {
  136. package : grunt.file.readJSON('package.json'),
  137. /*******************************
  138. Watch
  139. *******************************/
  140. // watches for changes in a source folder
  141. watch: {
  142. options: {
  143. spawn: false
  144. },
  145. scripts: {
  146. files: [
  147. 'test/**/*.js',
  148. 'src/**/*.js'
  149. ],
  150. tasks : testWatchTasks
  151. },
  152. src: {
  153. files: [
  154. 'build/examples/**/*',
  155. 'src/**/*.less',
  156. 'src/**/*.variables',
  157. 'src/**/*.config',
  158. 'src/**/*.js'
  159. ],
  160. tasks : watchTasks
  161. }
  162. },
  163. /*******************************
  164. Test
  165. *******************************/
  166. clear: {
  167. terminal: {
  168. }
  169. },
  170. karma: {
  171. watch: {
  172. configFile : 'karma.conf.js',
  173. background : true
  174. },
  175. travis: {
  176. configFile : 'karma.conf.js',
  177. singleRun : true
  178. }
  179. },
  180. /*******************************
  181. Build
  182. *******************************/
  183. autoprefixer: {
  184. options: {
  185. browsers: [
  186. 'last 2 version',
  187. '> 1%',
  188. 'opera 12.1',
  189. 'safari 6',
  190. 'ie 9',
  191. 'bb 10',
  192. 'android 4'
  193. ]
  194. },
  195. prefixBuild: {
  196. expand : true,
  197. cwd : 'build/',
  198. dest : 'build/',
  199. src : [
  200. '**/*.css'
  201. ]
  202. },
  203. prefixDocs: {
  204. expand : true,
  205. cwd : 'docs/build/',
  206. dest : 'docs/build/',
  207. src : [
  208. '**/*.css'
  209. ]
  210. },
  211. prefixFile: {
  212. src : 'docs/build/**/*.css'
  213. }
  214. },
  215. clean: {
  216. options: {
  217. force: true
  218. },
  219. build : [
  220. 'build/less',
  221. 'build/minified',
  222. 'build/packaged',
  223. 'build/uncompressed'
  224. ],
  225. release : [
  226. 'docs/build',
  227. 'rtl'
  228. ]
  229. },
  230. docco: {
  231. generate: {
  232. options: {
  233. css : 'spec/assets/docco.css',
  234. output : 'spec/docs/'
  235. },
  236. files: [
  237. {
  238. expand : true,
  239. cwd : 'spec/',
  240. src : [
  241. '**.commented.js'
  242. ]
  243. }
  244. ]
  245. }
  246. },
  247. cssjanus: {
  248. rtl: {
  249. expand : true,
  250. cwd : 'build/',
  251. src : [
  252. '**/*.less',
  253. '**/*.css',
  254. ],
  255. dest : 'rtl'
  256. },
  257. },
  258. less: {
  259. options: {
  260. paths : ['src'],
  261. compress : false,
  262. optimization : 2
  263. },
  264. // optimized for watch, src is built on watch task using callbacks
  265. buildDocsCSS: {
  266. src : 'src',
  267. dest : 'docs/build/uncompressed/',
  268. rename : preserveFileExtensions
  269. },
  270. buildTestCSS: {
  271. expand : true,
  272. cwd : 'src',
  273. src : [
  274. '**/*.less'
  275. ],
  276. dest : 'docs/build/uncompressed/',
  277. rename: preserveFileExtensions
  278. },
  279. buildCSS: {
  280. expand : true,
  281. cwd : 'src',
  282. src : [
  283. '**/*.less'
  284. ],
  285. dest : 'build/uncompressed/',
  286. rename: preserveFileExtensions
  287. },
  288. outputCSS: {
  289. cwd : 'src',
  290. src : outputPath + '.less',
  291. dest : 'build/uncompressed/' + outputPath + '.css' ,
  292. variables : {
  293. },
  294. rename: preserveFileExtensions
  295. }
  296. },
  297. copy: {
  298. themesToDocs: {
  299. files: [
  300. // exact copy for less
  301. {
  302. expand : true,
  303. cwd : 'src/themes/',
  304. src : [
  305. '**/*'
  306. ],
  307. dest : 'docs/build/less/themes'
  308. }
  309. ]
  310. },
  311. srcToDocs: {
  312. files: [
  313. // exact copy for less
  314. {
  315. expand : true,
  316. cwd : 'src/**/*.less',
  317. src : [
  318. '**/*'
  319. ],
  320. dest : 'docs/build/less'
  321. },
  322. // copy everything but less files for uncompressed release
  323. {
  324. expand : true,
  325. cwd : 'src/',
  326. src : [
  327. '**/*.js',
  328. 'themes/**/*'
  329. ],
  330. dest : 'docs/build/uncompressed'
  331. },
  332. // copy assets only for minified version
  333. {
  334. expand : true,
  335. cwd : 'src/',
  336. src : [
  337. 'themes/**/*'
  338. ],
  339. dest : 'docs/build/minified'
  340. },
  341. // copy assets only for packaged version
  342. {
  343. expand : true,
  344. cwd : 'src/',
  345. src : [
  346. 'themes/**/*'
  347. ],
  348. dest : 'docs/build/packaged'
  349. }
  350. ]
  351. },
  352. srcToBuild: {
  353. files: [
  354. // exact copy for less
  355. {
  356. expand : true,
  357. cwd : 'src/',
  358. src : [
  359. '**/*'
  360. ],
  361. dest : 'build/less'
  362. },
  363. // copy everything but less files for uncompressed release
  364. {
  365. expand : true,
  366. cwd : 'src/',
  367. src : [
  368. '**/*.js',
  369. 'themes/**/*'
  370. ],
  371. dest : 'build/uncompressed'
  372. },
  373. // copy assets only for minified version
  374. {
  375. expand : true,
  376. cwd : 'src/',
  377. src : [
  378. 'themes/**/*'
  379. ],
  380. dest : 'build/minified'
  381. },
  382. // copy assets only for packaged version
  383. {
  384. expand : true,
  385. cwd : 'src/',
  386. src : [
  387. 'themes/**/*'
  388. ],
  389. dest : 'build/packaged'
  390. }
  391. ]
  392. },
  393. // create new rtl assets
  394. buildToRTL: {
  395. files: [
  396. {
  397. expand : true,
  398. cwd : 'build/',
  399. src : [
  400. '**'
  401. ],
  402. dest : 'rtl'
  403. }
  404. ]
  405. },
  406. // make library available in docs
  407. buildToDocs: {
  408. files: [
  409. {
  410. expand : true,
  411. cwd : 'build/',
  412. src : [
  413. '**'
  414. ],
  415. dest : 'docs/build/'
  416. }
  417. ]
  418. },
  419. // copy spec files to docs
  420. specToDocs: {
  421. files: [
  422. {
  423. expand : true,
  424. cwd : 'spec',
  425. src : [
  426. '**'
  427. ],
  428. dest : 'docs/spec/'
  429. }
  430. ]
  431. },
  432. // copy spec files to docs
  433. examplesToDocs: {
  434. files: [
  435. {
  436. expand : true,
  437. cwd : 'build/examples',
  438. src : [
  439. '**'
  440. ],
  441. dest : 'docs/build/examples/'
  442. }
  443. ]
  444. }
  445. },
  446. compress: {
  447. options: {
  448. archive: 'docs/build/semantic.zip'
  449. },
  450. everything: {
  451. files: [
  452. {
  453. expand : true,
  454. cwd : 'build/',
  455. src : [
  456. '**'
  457. ]
  458. }
  459. ]
  460. }
  461. },
  462. concat: {
  463. options: {
  464. },
  465. createCSSPackage: {
  466. src: ['build/uncompressed/**/*.css'],
  467. dest: 'build/packaged/css/semantic.css'
  468. },
  469. createJSPackage: {
  470. src: ['build/uncompressed/**/*.js'],
  471. dest: 'build/packaged/javascript/semantic.js'
  472. },
  473. createDocsCSSPackage: {
  474. src: ['docs/build/uncompressed/**/*.css'],
  475. dest: 'docs/build/packaged/css/semantic.css'
  476. },
  477. createDocsJSPackage: {
  478. src: ['docs/build/uncompressed/**/*.js'],
  479. dest: 'docs/build/packaged/javascript/semantic.js'
  480. },
  481. },
  482. cssmin: {
  483. options : {
  484. keepSpecialComments: 0,
  485. report: 'min',
  486. banner : '' +
  487. '/*\n' +
  488. '* # <%= package.title %>\n' +
  489. '* Version: <%= package.version %>\n' +
  490. '* http://github.com/jlukic/semantic-ui\n' +
  491. '*\n' +
  492. '*\n' +
  493. '* Copyright <%= grunt.template.today("yyyy") %> Contributors\n' +
  494. '* Released under the MIT license\n' +
  495. '* http://opensource.org/licenses/MIT\n' +
  496. '*\n' +
  497. '* Released: <%= grunt.template.today("mm/dd/yyyy") %>\n' +
  498. '*/\n'
  499. },
  500. // copy minified css to minified release
  501. minifyCSS: {
  502. expand : true,
  503. cwd : 'build/uncompressed',
  504. src : [
  505. '**/*.css'
  506. ],
  507. dest : 'build/minified/',
  508. rename: preserveMinFileExtensions
  509. },
  510. // add comment banner to css release
  511. createMinCSSPackage: {
  512. files: {
  513. 'build/packaged/css/semantic.min.css': [
  514. 'build/uncompressed/**/*.css'
  515. ]
  516. }
  517. }
  518. },
  519. uglify: {
  520. minifyJS: {
  521. expand : true,
  522. cwd : 'build/uncompressed',
  523. src : [
  524. '**/*.js'
  525. ],
  526. dest : 'build/minified',
  527. ext : '.min.js',
  528. banner : '' +
  529. '/*' +
  530. '* # <%= package.title %>\n' +
  531. '* Version: <%= package.version %>\n' +
  532. '* http://github.com/jlukic/semantic-ui\n' +
  533. '*\n' +
  534. '*\n' +
  535. '* Copyright <%= grunt.template.today("yyyy") %> Contributors\n' +
  536. '* Released under the MIT license\n' +
  537. '* http://opensource.org/licenses/MIT\n' +
  538. '*\n' +
  539. '* Release Date: <%= grunt.template.today("mm/dd/yyyy") %>\n' +
  540. '*/\n'
  541. },
  542. createMinJSPackage: {
  543. options: {
  544. mangle : true,
  545. compress : true,
  546. banner : '' +
  547. '/*' +
  548. '* # <%= package.title %>\n' +
  549. '* Version: <%= package.version %>\n' +
  550. '* http://github.com/jlukic/semantic-ui\n' +
  551. '*\n' +
  552. '*\n' +
  553. '* Copyright <%= grunt.template.today("yyyy") %> Contributors\n' +
  554. '* Released under the MIT license\n' +
  555. '* http://opensource.org/licenses/MIT\n' +
  556. '*\n' +
  557. '* Release Date: <%= grunt.template.today("mm/dd/yyyy") %>\n' +
  558. '*/\n'
  559. },
  560. files: {
  561. 'build/packaged/javascript/semantic.min.js': [
  562. 'build/uncompressed/**/*.js'
  563. ]
  564. }
  565. }
  566. },
  567. coveralls: {
  568. options: {
  569. coverage_dir: 'coverage'
  570. }
  571. }
  572. };
  573. grunt.loadNpmTasks('grunt-contrib-clean');
  574. grunt.loadNpmTasks('grunt-contrib-compress');
  575. grunt.loadNpmTasks('grunt-contrib-concat');
  576. grunt.loadNpmTasks('grunt-contrib-copy');
  577. grunt.loadNpmTasks('grunt-contrib-cssmin');
  578. grunt.loadNpmTasks('grunt-contrib-less');
  579. grunt.loadNpmTasks('grunt-contrib-uglify');
  580. grunt.loadNpmTasks('grunt-contrib-watch');
  581. grunt.loadNpmTasks('grunt-autoprefixer');
  582. grunt.loadNpmTasks('grunt-docco-multi');
  583. grunt.loadNpmTasks('grunt-cssjanus');
  584. grunt.loadNpmTasks('grunt-clear');
  585. grunt.loadNpmTasks('grunt-karma');
  586. grunt.loadNpmTasks('grunt-karma-coveralls');
  587. grunt.initConfig(config);
  588. grunt.registerTask('default', defaultTasks);
  589. grunt.registerTask('test', testTasks);
  590. grunt.registerTask('release', releaseTasks);
  591. grunt.registerTask('rtl', rtlTasks);
  592. grunt.registerTask('docs', docTasks);
  593. grunt.registerTask('build', buildTasks);
  594. grunt.registerTask('reset', resetTasks);
  595. // compiles only changed less files <https://npmjs.org/package/grunt-contrib-watch>
  596. grunt.event.on('watch', setWatchFiles);
  597. };