eleventy.config.mjs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. import { readFileSync } from 'node:fs';
  2. import { EleventyRenderPlugin } from "@11ty/eleventy";
  3. import { join, dirname } from 'node:path';
  4. import { sync } from 'glob';
  5. import { appConfig } from '@repo/e11ty'
  6. /*
  7. * Copy list
  8. */
  9. const getCopyList = () => {
  10. let copy = {
  11. "node_modules/@tabler/core/dist": "dist",
  12. "pages/favicon.ico": "favicon.ico",
  13. "static": "static",
  14. }
  15. const libs = JSON.parse(readFileSync('./pages/_data/libs.json'));
  16. let files = []
  17. Object.keys(libs.js).forEach((lib) => {
  18. files.push(Array.isArray(libs.js[lib]) ? libs.js[lib] : [libs.js[lib]])
  19. })
  20. Object.keys(libs.css).forEach((lib) => {
  21. files.push(Array.isArray(libs.css[lib]) ? libs.css[lib] : [libs.css[lib]])
  22. })
  23. Object.keys(libs['js-copy']).forEach((lib) => {
  24. files.push(libs['js-copy'][lib])
  25. })
  26. files = files.flat()
  27. files.forEach((file) => {
  28. if (!file.match(/^https?/)) {
  29. copy[`node_modules/${dirname(file)}`] = `libs/${dirname(file) }`;
  30. }
  31. })
  32. return copy;
  33. }
  34. /** @type {import('@11ty/eleventy').LocalConfig} */
  35. export default function (eleventyConfig) {
  36. const environment = process.env.NODE_ENV || "production";
  37. eleventyConfig.setInputDirectory("pages");
  38. eleventyConfig.setOutputDirectory("dist");
  39. eleventyConfig.setLayoutsDirectory("_layouts");
  40. eleventyConfig.setIncludesDirectory("_includes");
  41. // eleventyConfig.addWatchTarget("../core/dist/**");
  42. // eleventyConfig.setWatchThrottleWaitTime(100);
  43. eleventyConfig.addPassthroughCopy(getCopyList());
  44. eleventyConfig.addPlugin(EleventyRenderPlugin, {
  45. accessGlobalData: true,
  46. });
  47. appConfig(eleventyConfig);
  48. /**
  49. * Server
  50. */
  51. if (process.env.ELEVENTY_RUN_MODE === "serve") {
  52. eleventyConfig.setServerPassthroughCopyBehavior("passthrough");
  53. }
  54. /**
  55. * Data
  56. */
  57. eleventyConfig.addGlobalData("environment", environment);
  58. eleventyConfig.addGlobalData("package", JSON.parse(readFileSync(join("..", "core", "package.json"), "utf-8")));
  59. eleventyConfig.addGlobalData("readme", readFileSync(join("..", "README.md"), "utf-8"));
  60. eleventyConfig.addGlobalData("license", readFileSync(join("..", "LICENSE"), "utf-8"));
  61. eleventyConfig.addGlobalData("changelog", readFileSync(join("..", "CHANGELOG.md"), "utf-8"));
  62. eleventyConfig.addGlobalData("pages", () => {
  63. return sync('pages/**/*.html').filter((file) => {
  64. return !file.includes('pages/_') && !file.includes('pages/docs/index.html');
  65. }).map((file) => {
  66. return {
  67. url: file.replace(/^pages\//, '/')
  68. }
  69. });
  70. });
  71. eleventyConfig.addGlobalData("site", {
  72. title: "Tabler",
  73. description: "Premium and Open Source dashboard template with responsive and high quality UI.",
  74. themeColor: "#066fd1",
  75. email: "support@tabler.io",
  76. homepage: "https://tabler.io",
  77. githubUrl: "https://github.com/tabler/tabler",
  78. githubSponsorsUrl: "https://github.com/sponsors/codecalm",
  79. changelogUrl: "https://github.com/tabler/tabler/releases",
  80. sponsorUrl: "https://github.com/sponsors/codecalm",
  81. previewUrl: "https://preview.tabler.io",
  82. docsUrl: "https://tabler.io/docs",
  83. mapboxKey: "pk.eyJ1IjoidGFibGVyIiwiYSI6ImNscHh3dnhndjB2M3QycW85bGd0NXRmZ3YifQ.9LfHPsNoEXQH-xzz-81Ffw",
  84. googleMapsKey: "AIzaSyAr5mRB4U1KRkVznIrDWEvZjroYcD202DI",
  85. googleMapsDevKey: "AIzaSyCL-BY8-sq12m0S9H-S_yMqDmcun3A9znw",
  86. npmPackage: "@tabler/core",
  87. tablerCssPlugins: [
  88. "tabler-flags",
  89. "tabler-socials",
  90. "tabler-payments",
  91. "tabler-vendors",
  92. "tabler-marketing"
  93. ],
  94. icons: {
  95. link: "https://tabler.io/icons"
  96. },
  97. emails: {
  98. price: "$29",
  99. buy_link: "https://r.tabler.io/buy-emails"
  100. },
  101. illustrations: {
  102. price: "$59",
  103. count: 50,
  104. buy_link: "https://r.tabler.io/buy-illustrations"
  105. },
  106. colors: {
  107. "blue": {
  108. "class": "blue",
  109. "hex": "#066fd1",
  110. "title": "Blue"
  111. },
  112. "azure": {
  113. "class": "azure",
  114. "hex": "#45aaf2",
  115. "title": "Azure"
  116. },
  117. "indigo": {
  118. "class": "indigo",
  119. "hex": "#6574cd",
  120. "title": "Indigo"
  121. },
  122. "purple": {
  123. "class": "purple",
  124. "hex": "#a55eea",
  125. "title": "Purple"
  126. },
  127. "pink": {
  128. "class": "pink",
  129. "hex": "#f66d9b",
  130. "title": "Pink"
  131. },
  132. "red": {
  133. "class": "red",
  134. "hex": "#fa4654",
  135. "title": "Red"
  136. },
  137. "orange": {
  138. "class": "orange",
  139. "hex": "#fd9644",
  140. "title": "Orange"
  141. },
  142. "yellow": {
  143. "class": "yellow",
  144. "hex": "#f1c40f",
  145. "title": "Yellow"
  146. },
  147. "lime": {
  148. "class": "lime",
  149. "hex": "#7bd235",
  150. "title": "Lime"
  151. },
  152. "green": {
  153. "class": "green",
  154. "hex": "#5eba00",
  155. "title": "Green"
  156. },
  157. "teal": {
  158. "class": "teal",
  159. "hex": "#2bcbba",
  160. "title": "Teal"
  161. },
  162. "cyan": {
  163. "class": "cyan",
  164. "hex": "#17a2b8",
  165. "title": "Cyan"
  166. }
  167. },
  168. skinColors: {
  169. "rose": {
  170. "hex": "#FFCB9D",
  171. "title": "Rose",
  172. "class": "rose"
  173. },
  174. "yellow": {
  175. "hex": "#F0BA60",
  176. "title": "Yellow",
  177. "class": "yellow"
  178. },
  179. "skin-1": {
  180. "hex": "#e2c6a7",
  181. "title": "Skin 1",
  182. "class": "skin-1"
  183. },
  184. "skin-2": {
  185. "hex": "#c7a786",
  186. "title": "Skin 2",
  187. "class": "skin-2"
  188. },
  189. "skin-3": {
  190. "hex": "#a68063",
  191. "title": "Skin 3",
  192. "class": "skin-3"
  193. },
  194. "skin-4": {
  195. "hex": "#926241",
  196. "title": "Skin 4",
  197. "class": "skin-4"
  198. },
  199. "skin-5": {
  200. "hex": "#654c45",
  201. "title": "Skin 5",
  202. "class": "skin-5"
  203. },
  204. "gray": {
  205. "hex": "#d5d7dd",
  206. "title": "Gray",
  207. "class": "gray"
  208. }
  209. },
  210. colorsExtra: {
  211. "white": {
  212. "hex": "#ffffff",
  213. "title": "White"
  214. },
  215. "dark": {
  216. "hex": "#303645",
  217. "title": "Dark"
  218. },
  219. "gray": {
  220. "hex": "#868e96",
  221. "title": "Gray"
  222. }
  223. },
  224. variants: [
  225. {
  226. "name": "success",
  227. "icon": "check"
  228. },
  229. {
  230. "name": "info",
  231. "icon": "info-circle"
  232. },
  233. {
  234. "name": "warning",
  235. "icon": "alert-triangle"
  236. },
  237. {
  238. "name": "danger",
  239. "icon": "alert-circle"
  240. }
  241. ],
  242. "themeColors": {
  243. "primary": {
  244. "class": "primary",
  245. "title": "Primary"
  246. },
  247. "secondary": {
  248. "class": "secondary",
  249. "title": "Secondary"
  250. },
  251. "success": {
  252. "class": "success",
  253. "title": "Success"
  254. },
  255. "warning": {
  256. "class": "warning",
  257. "title": "Warning"
  258. },
  259. "danger": {
  260. "class": "danger",
  261. "title": "Danger"
  262. },
  263. "info": {
  264. "class": "info",
  265. "title": "Info"
  266. },
  267. "dark": {
  268. "class": "dark",
  269. "title": "Dark"
  270. },
  271. "light": {
  272. "class": "light",
  273. "title": "Light"
  274. }
  275. },
  276. "buttonStates": [
  277. {
  278. "class": null,
  279. "title": "Normal"
  280. },
  281. {
  282. "class": "active",
  283. "title": "Active state"
  284. },
  285. {
  286. "class": "disabled",
  287. "title": "Disabled"
  288. }
  289. ],
  290. "socials": {
  291. "x": {
  292. "icon": "brand-x",
  293. "title": "X"
  294. },
  295. "facebook": {
  296. "icon": "brand-facebook",
  297. "title": "Facebook"
  298. },
  299. "twitter": {
  300. "icon": "brand-twitter",
  301. "title": "Twitter"
  302. },
  303. "google": {
  304. "icon": "brand-google",
  305. "title": "Google"
  306. },
  307. "youtube": {
  308. "icon": "brand-youtube",
  309. "title": "Youtube"
  310. },
  311. "vimeo": {
  312. "icon": "brand-vimeo",
  313. "title": "Vimeo"
  314. },
  315. "dribbble": {
  316. "icon": "brand-dribbble",
  317. "title": "Dribbble"
  318. },
  319. "github": {
  320. "icon": "brand-github",
  321. "title": "Github"
  322. },
  323. "instagram": {
  324. "icon": "brand-instagram",
  325. "title": "Instagram"
  326. },
  327. "pinterest": {
  328. "icon": "brand-pinterest",
  329. "title": "Pinterest"
  330. },
  331. "vk": {
  332. "icon": "brand-vk",
  333. "title": "VK"
  334. },
  335. "rss": {
  336. "icon": "rss",
  337. "title": "RSS"
  338. },
  339. "flickr": {
  340. "icon": "brand-flickr",
  341. "title": "Flickr"
  342. },
  343. "bitbucket": {
  344. "icon": "brand-bitbucket",
  345. "title": "Bitbucket"
  346. },
  347. "tabler": {
  348. "icon": "brand-tabler",
  349. "title": "Tabler"
  350. }
  351. },
  352. "months-short": [
  353. "Jan",
  354. "Feb",
  355. "Mar",
  356. "Apr",
  357. "May",
  358. "Jun",
  359. "Jul",
  360. "Aug",
  361. "Sep",
  362. "Oct",
  363. "Nov",
  364. "Dec"
  365. ],
  366. "months-long": [
  367. "January",
  368. "February",
  369. "March",
  370. "April",
  371. "May",
  372. "June",
  373. "July",
  374. "August",
  375. "September",
  376. "October",
  377. "November",
  378. "December"
  379. ]
  380. });
  381. };