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
10 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
10 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(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/**/*.overrides',
  158. 'src/**/*.config',
  159. 'src/**/*.js'
  160. ],
  161. tasks : watchTasks
  162. }
  163. },
  164. /*******************************
  165. Test
  166. *******************************/
  167. clear: {
  168. terminal: {
  169. }
  170. },
  171. karma: {
  172. watch: {
  173. configFile : 'karma.conf.js',
  174. background : true
  175. },
  176. travis: {
  177. configFile : 'karma.conf.js',
  178. singleRun : true
  179. }
  180. },
  181. /*******************************
  182. Build
  183. *******************************/
  184. autoprefixer: {
  185. options: {
  186. browsers: [
  187. 'last 2 version',
  188. '> 1%',
  189. 'opera 12.1',
  190. 'safari 6',
  191. 'ie 9',
  192. 'bb 10',
  193. 'android 4'
  194. ]
  195. },
  196. prefixBuild: {
  197. expand : true,
  198. cwd : 'build/',
  199. dest : 'build/',
  200. src : [
  201. '**/*.css'
  202. ]
  203. },
  204. prefixDocs: {
  205. expand : true,
  206. cwd : 'docs/build/',
  207. dest : 'docs/build/',
  208. src : [
  209. '**/*.css'
  210. ]
  211. },
  212. prefixFile: {
  213. src : 'docs/build/**/*.css'
  214. }
  215. },
  216. clean: {
  217. options: {
  218. force: true
  219. },
  220. build : [
  221. 'build/less',
  222. 'build/minified',
  223. 'build/packaged',
  224. 'build/uncompressed'
  225. ],
  226. release : [
  227. 'docs/build',
  228. 'rtl'
  229. ]
  230. },
  231. docco: {
  232. generate: {
  233. options: {
  234. css : 'spec/assets/docco.css',
  235. output : 'spec/docs/'
  236. },
  237. files: [
  238. {
  239. expand : true,
  240. cwd : 'spec/',
  241. src : [
  242. '**.commented.js'
  243. ]
  244. }
  245. ]
  246. }
  247. },
  248. cssjanus: {
  249. rtl: {
  250. expand : true,
  251. cwd : 'build/',
  252. src : [
  253. '**/*.less',
  254. '**/*.css',
  255. ],
  256. dest : 'rtl'
  257. },
  258. },
  259. less: {
  260. options: {
  261. paths : ['src'],
  262. compress : false,
  263. optimization : 2
  264. },
  265. // optimized for watch, src is built on watch task using callbacks
  266. buildDocsCSS: {
  267. src : 'src',
  268. dest : 'docs/build/uncompressed/',
  269. rename : preserveFileExtensions
  270. },
  271. buildTestCSS: {
  272. expand : true,
  273. cwd : 'src',
  274. src : [
  275. '**/*.less'
  276. ],
  277. dest : 'docs/build/uncompressed/',
  278. rename: preserveFileExtensions
  279. },
  280. buildCSS: {
  281. expand : true,
  282. cwd : 'src',
  283. src : [
  284. '**/*.less'
  285. ],
  286. dest : 'build/uncompressed/',
  287. rename: preserveFileExtensions
  288. },
  289. outputCSS: {
  290. cwd : 'src',
  291. src : outputPath + '.less',
  292. dest : 'build/uncompressed/' + outputPath + '.css' ,
  293. variables : {
  294. },
  295. rename: preserveFileExtensions
  296. }
  297. },
  298. copy: {
  299. themesToDocs: {
  300. files: [
  301. // exact copy for less
  302. {
  303. expand : true,
  304. cwd : 'src/themes/',
  305. src : [
  306. '**/*'
  307. ],
  308. dest : 'docs/build/less/themes'
  309. }
  310. ]
  311. },
  312. srcToDocs: {
  313. files: [
  314. // exact copy for less
  315. {
  316. expand : true,
  317. cwd : 'src/',
  318. src : [
  319. '**/*'
  320. ],
  321. dest : 'docs/build/less'
  322. },
  323. // copy everything but less files for uncompressed release
  324. {
  325. expand : true,
  326. cwd : 'src/',
  327. src : [
  328. '**/*.js',
  329. 'themes/**/*'
  330. ],
  331. dest : 'docs/build/uncompressed'
  332. },
  333. // copy assets only for minified version
  334. {
  335. expand : true,
  336. cwd : 'src/',
  337. src : [
  338. 'themes/**/*'
  339. ],
  340. dest : 'docs/build/minified'
  341. },
  342. // copy assets only for packaged version
  343. {
  344. expand : true,
  345. cwd : 'src/',
  346. src : [
  347. 'themes/**/*'
  348. ],
  349. dest : 'docs/build/packaged'
  350. }
  351. ]
  352. },
  353. srcToBuild: {
  354. files: [
  355. // exact copy for less
  356. {
  357. expand : true,
  358. cwd : 'src/',
  359. src : [
  360. '**/*'
  361. ],
  362. dest : 'build/less'
  363. },
  364. // copy everything but less files for uncompressed release
  365. {
  366. expand : true,
  367. cwd : 'src/',
  368. src : [
  369. '**/*.js',
  370. 'themes/**/*'
  371. ],
  372. dest : 'build/uncompressed'
  373. },
  374. // copy assets only for minified version
  375. {
  376. expand : true,
  377. cwd : 'src/',
  378. src : [
  379. 'themes/**/*'
  380. ],
  381. dest : 'build/minified'
  382. },
  383. // copy assets only for packaged version
  384. {
  385. expand : true,
  386. cwd : 'src/',
  387. src : [
  388. 'themes/**/*'
  389. ],
  390. dest : 'build/packaged'
  391. }
  392. ]
  393. },
  394. // create new rtl assets
  395. buildToRTL: {
  396. files: [
  397. {
  398. expand : true,
  399. cwd : 'build/',
  400. src : [
  401. '**'
  402. ],
  403. dest : 'rtl'
  404. }
  405. ]
  406. },
  407. // make library available in docs
  408. buildToDocs: {
  409. files: [
  410. {
  411. expand : true,
  412. cwd : 'build/',
  413. src : [
  414. '**'
  415. ],
  416. dest : 'docs/build/'
  417. }
  418. ]
  419. },
  420. // copy spec files to docs
  421. specToDocs: {
  422. files: [
  423. {
  424. expand : true,
  425. cwd : 'spec',
  426. src : [
  427. '**'
  428. ],
  429. dest : 'docs/spec/'
  430. }
  431. ]
  432. },
  433. // copy spec files to docs
  434. examplesToDocs: {
  435. files: [
  436. {
  437. expand : true,
  438. cwd : 'build/examples',
  439. src : [
  440. '**'
  441. ],
  442. dest : 'docs/build/examples/'
  443. }
  444. ]
  445. }
  446. },
  447. compress: {
  448. options: {
  449. archive: 'docs/build/semantic.zip'
  450. },
  451. everything: {
  452. files: [
  453. {
  454. expand : true,
  455. cwd : 'build/',
  456. src : [
  457. '**'
  458. ]
  459. }
  460. ]
  461. }
  462. },
  463. concat: {
  464. options: {
  465. },
  466. createCSSPackage: {
  467. src: ['build/uncompressed/**/*.css'],
  468. dest: 'build/packaged/css/semantic.css'
  469. },
  470. createJSPackage: {
  471. src: ['build/uncompressed/**/*.js'],
  472. dest: 'build/packaged/javascript/semantic.js'
  473. },
  474. createDocsCSSPackage: {
  475. src: ['docs/build/uncompressed/**/*.css'],
  476. dest: 'docs/build/packaged/css/semantic.css'
  477. },
  478. createDocsJSPackage: {
  479. src: ['docs/build/uncompressed/**/*.js'],
  480. dest: 'docs/build/packaged/javascript/semantic.js'
  481. },
  482. },
  483. cssmin: {
  484. options : {
  485. keepSpecialComments: 0,
  486. report: 'min',
  487. banner : '' +
  488. '/*\n' +
  489. '* # <%= package.title %>\n' +
  490. '* Version: <%= package.version %>\n' +
  491. '* http://github.com/jlukic/semantic-ui\n' +
  492. '*\n' +
  493. '*\n' +
  494. '* Copyright <%= grunt.template.today("yyyy") %> Contributors\n' +
  495. '* Released under the MIT license\n' +
  496. '* http://opensource.org/licenses/MIT\n' +
  497. '*\n' +
  498. '* Released: <%= grunt.template.today("mm/dd/yyyy") %>\n' +
  499. '*/\n'
  500. },
  501. // copy minified css to minified release
  502. minifyCSS: {
  503. expand : true,
  504. cwd : 'build/uncompressed',
  505. src : [
  506. '**/*.css'
  507. ],
  508. dest : 'build/minified/',
  509. rename: preserveMinFileExtensions
  510. },
  511. // add comment banner to css release
  512. createMinCSSPackage: {
  513. files: {
  514. 'build/packaged/css/semantic.min.css': [
  515. 'build/uncompressed/**/*.css'
  516. ]
  517. }
  518. }
  519. },
  520. uglify: {
  521. minifyJS: {
  522. expand : true,
  523. cwd : 'build/uncompressed',
  524. src : [
  525. '**/*.js'
  526. ],
  527. dest : 'build/minified',
  528. ext : '.min.js',
  529. banner : '' +
  530. '/*' +
  531. '* # <%= package.title %>\n' +
  532. '* Version: <%= package.version %>\n' +
  533. '* http://github.com/jlukic/semantic-ui\n' +
  534. '*\n' +
  535. '*\n' +
  536. '* Copyright <%= grunt.template.today("yyyy") %> Contributors\n' +
  537. '* Released under the MIT license\n' +
  538. '* http://opensource.org/licenses/MIT\n' +
  539. '*\n' +
  540. '* Release Date: <%= grunt.template.today("mm/dd/yyyy") %>\n' +
  541. '*/\n'
  542. },
  543. createMinJSPackage: {
  544. options: {
  545. mangle : true,
  546. compress : true,
  547. banner : '' +
  548. '/*' +
  549. '* # <%= package.title %>\n' +
  550. '* Version: <%= package.version %>\n' +
  551. '* http://github.com/jlukic/semantic-ui\n' +
  552. '*\n' +
  553. '*\n' +
  554. '* Copyright <%= grunt.template.today("yyyy") %> Contributors\n' +
  555. '* Released under the MIT license\n' +
  556. '* http://opensource.org/licenses/MIT\n' +
  557. '*\n' +
  558. '* Release Date: <%= grunt.template.today("mm/dd/yyyy") %>\n' +
  559. '*/\n'
  560. },
  561. files: {
  562. 'build/packaged/javascript/semantic.min.js': [
  563. 'build/uncompressed/**/*.js'
  564. ]
  565. }
  566. }
  567. },
  568. coveralls: {
  569. options: {
  570. coverage_dir: 'coverage'
  571. }
  572. }
  573. };
  574. grunt.loadNpmTasks('grunt-contrib-clean');
  575. grunt.loadNpmTasks('grunt-contrib-compress');
  576. grunt.loadNpmTasks('grunt-contrib-concat');
  577. grunt.loadNpmTasks('grunt-contrib-copy');
  578. grunt.loadNpmTasks('grunt-contrib-cssmin');
  579. grunt.loadNpmTasks('grunt-contrib-less');
  580. grunt.loadNpmTasks('grunt-contrib-uglify');
  581. grunt.loadNpmTasks('grunt-contrib-watch');
  582. grunt.loadNpmTasks('grunt-autoprefixer');
  583. grunt.loadNpmTasks('grunt-docco-multi');
  584. grunt.loadNpmTasks('grunt-cssjanus');
  585. grunt.loadNpmTasks('grunt-clear');
  586. grunt.loadNpmTasks('grunt-karma');
  587. grunt.loadNpmTasks('grunt-karma-coveralls');
  588. grunt.initConfig(config);
  589. grunt.registerTask('default', defaultTasks);
  590. grunt.registerTask('test', testTasks);
  591. grunt.registerTask('release', releaseTasks);
  592. grunt.registerTask('rtl', rtlTasks);
  593. grunt.registerTask('docs', docTasks);
  594. grunt.registerTask('build', buildTasks);
  595. grunt.registerTask('reset', resetTasks);
  596. // compiles only changed less files <https://npmjs.org/package/grunt-contrib-watch>
  597. grunt.event.on('watch', setWatchFiles);
  598. };