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.

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