11const path = require ( 'path' )
22const setupPlugins = function ( { root } ) {
3- const plugins = [
4- async function tailwindPlugin ( context , options ) {
5- return {
6- name : 'docusaurus-tailwindcss' ,
7- configurePostCss ( postcssOptions ) {
8- // Appends TailwindCSS and AutoPrefixer.
9- postcssOptions . plugins . push ( require ( 'tailwindcss' ) )
10- postcssOptions . plugins . push ( require ( 'autoprefixer' ) )
11- return postcssOptions
3+ const plugins = [
4+ async function tailwindPlugin ( context , options ) {
5+ return {
6+ name : 'docusaurus-tailwindcss' ,
7+ configurePostCss ( postcssOptions ) {
8+ // Appends TailwindCSS and AutoPrefixer.
9+ postcssOptions . plugins . push ( require ( 'tailwindcss' ) )
10+ postcssOptions . plugins . push ( require ( 'autoprefixer' ) )
11+ return postcssOptions
12+ } ,
13+ }
1214 } ,
13- }
14- } ,
1515
16- // Handle "back to main menu" issue with Docusaurus
17- // When the rendered webpage zoomed to 200%, the "back to main menu" is not functional.
18- // This function removes the DOM element after rendering.
19- function handleBackToMainMenuBtn ( context , options ) {
20- return {
21- name : 'handle-back-to-main-btn' ,
22- injectHtmlTags ( { content } ) {
23- return {
24- postBodyTags : [
25- `<script>
16+ // Handle "back to main menu" issue with Docusaurus
17+ // When the rendered webpage zoomed to 200%, the "back to main menu" is not functional.
18+ // This function removes the DOM element after rendering.
19+ function handleBackToMainMenuBtn ( context , options ) {
20+ return {
21+ name : 'handle-back-to-main-btn' ,
22+ injectHtmlTags ( { content } ) {
23+ return {
24+ postBodyTags : [
25+ `<script>
2626 document.addEventListener('keyup', (event)=> {
2727 if(event.key === 'Tab') {
2828 const backBtn = document.querySelector(".navbar-sidebar__back");
@@ -40,33 +40,14 @@ const setupPlugins = function ({ root }) {
4040 if(backBtn) backBtn.style.display = "none";
4141 });
4242 </script>` ,
43- ] ,
44- }
43+ ] ,
44+ }
45+ } ,
46+ }
4547 } ,
46- }
47- } ,
48- ]
49-
50-
51- // only add gtag in production
52- //const trackingID = process.env.trackingID
53- // gtmTrackingID = process.env.gtmTrackingID
54- //if (trackingID && trackingID !== '' && gtmTrackingID && gtmTrackingID !== '') {
55- const consentPlugin = [
56- path . resolve ( root , 'src/plugins/visitor-tracking-plugin' ) ,
57- {
58- trackingID,
59- gtmTrackingID,
60- anonymizeIP : true ,
61- } ,
6248 ]
63- plugins . push ( consentPlugin )
64- // console.log(`Add visitor-tracking-plugin Successfully. tracking ID: ${trackingID}, GTM tracking ID: ${gtmTrackingID}`)
65- //} else {
66- // console.warn('Failed to get "trackingID" for gtag! Should be null in development, but should be non empty string in Production.')
67- //}
6849
69- return plugins
50+ return plugins
7051}
7152
72- module . exports = setupPlugins
53+ module . exports = setupPlugins
0 commit comments