Bug 32422: Hardcoded paths in _common.scss precent using external node_modules
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 7 Dec 2022 19:16:58 +0000 (16:16 -0300)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 12 Dec 2022 15:19:10 +0000 (12:19 -0300)
This patch makes:

- gulpfile.js add the parent dir's node_modules to the sass include path
- removes hardcoded paths from _common.scss

To test:
1. Have the latest KTD image (this is not KTD specific, but easier to
   test)
2. Make sure you don't have any node_modules/ dir in your koha clone
3. Run:
   $ kshell
  k$ yarn build --view opac
=> FAIL: You get:
kohadev-koha@kohadevbox:/kohadevbox/koha$ yarn build --view opac
yarn run v1.22.19
$ gulp build --view opac
[18:27:38] Using gulpfile /kohadevbox/koha/gulpfile.js
[18:27:38] Starting 'build'...
Error in plugin 'sass'
Message:
    koha-tmpl/opac-tmpl/bootstrap/css/src/_common.scss
Error: File to import not found or unreadable: ../../../../../node_modules/bootstrap/scss/functions.
        on line 37 of koha-tmpl/opac-tmpl/bootstrap/css/src/_common.scss
        from line 1 of koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss
>> @import "../../../../../node_modules/bootstrap/scss/functions";

   ^

4. Apply this patch
5. Repeat 3
=> SUCCESS: It builds!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
gulpfile.js
koha-tmpl/opac-tmpl/bootstrap/css/src/_common.scss

index f41f53a..a17b66e 100644 (file)
@@ -37,7 +37,11 @@ if (args.view == "opac") {
 
 var sassOptions = {
     errLogToConsole: true,
-    precision: 3
+    precision: 3,
+    includePaths: [
+        __dirname + '/node_modules',
+        __dirname + '/../node_modules'
+    ]
 }
 
 // CSS processing for development
index ec6da81..36d45f3 100644 (file)
@@ -34,52 +34,52 @@ $high-contrast-grey: #666666;
 }
 
 /* Bootstrap imports */
-@import "../../../../../node_modules/bootstrap/scss/functions";
-@import "../../../../../node_modules/bootstrap/scss/variables";
-@import "../../../../../node_modules/bootstrap/scss/mixins";
-@import "../../../../../node_modules/bootstrap/scss/alert";
-
-// @import "../../../../../node_modules/bootstrap/scss/badge";
-@import "../../../../../node_modules/bootstrap/scss/breadcrumb";
-@import "../../../../../node_modules/bootstrap/scss/button-group";
-@import "../../../../../node_modules/bootstrap/scss/buttons";
-@import "../../../../../node_modules/bootstrap/scss/card";
-
-// @import "../../../../../node_modules/bootstrap/scss/carousel";
-@import "../../../../../node_modules/bootstrap/scss/close";
-
-// @import "../../../../../node_modules/bootstrap/scss/code";
-@import "../../../../../node_modules/bootstrap/scss/custom-forms";
-@import "../../../../../node_modules/bootstrap/scss/dropdown";
-@import "../../../../../node_modules/bootstrap/scss/forms";
-@import "../../../../../node_modules/bootstrap/scss/grid";
-
-// @import "../../../../../node_modules/bootstrap/scss/images";
-@import "../../../../../node_modules/bootstrap/scss/input-group";
-
-// @import "../../../../../node_modules/bootstrap/scss/jumbotron";
-// @import "../../../../../node_modules/bootstrap/scss/list-group";
-// @import "../../../../../node_modules/bootstrap/scss/media";
-@import "../../../../../node_modules/bootstrap/scss/modal";
-@import "../../../../../node_modules/bootstrap/scss/navbar";
-@import "../../../../../node_modules/bootstrap/scss/nav";
-@import "../../../../../node_modules/bootstrap/scss/pagination";
-
-// @import "../../../../../node_modules/bootstrap/scss/popover";
-@import "../../../../../node_modules/bootstrap/scss/print";
-
-// @import "../../../../../node_modules/bootstrap/scss/progress";
-@import "../../../../../node_modules/bootstrap/scss/reboot";
-@import "../../../../../node_modules/bootstrap/scss/root";
-
-// @import "../../../../../node_modules/bootstrap/scss/spinners";
-@import "../../../../../node_modules/bootstrap/scss/tables";
-
-// @import "../../../../../node_modules/bootstrap/scss/toasts";
-@import "../../../../../node_modules/bootstrap/scss/tooltip";
-@import "../../../../../node_modules/bootstrap/scss/transitions";
-@import "../../../../../node_modules/bootstrap/scss/type";
-@import "../../../../../node_modules/bootstrap/scss/utilities";
+@import "bootstrap/scss/functions";
+@import "bootstrap/scss/variables";
+@import "bootstrap/scss/mixins";
+@import "bootstrap/scss/alert";
+
+// @import "bootstrap/scss/badge";
+@import "bootstrap/scss/breadcrumb";
+@import "bootstrap/scss/button-group";
+@import "bootstrap/scss/buttons";
+@import "bootstrap/scss/card";
+
+// @import "bootstrap/scss/carousel";
+@import "bootstrap/scss/close";
+
+// @import "bootstrap/scss/code";
+@import "bootstrap/scss/custom-forms";
+@import "bootstrap/scss/dropdown";
+@import "bootstrap/scss/forms";
+@import "bootstrap/scss/grid";
+
+// @import "bootstrap/scss/images";
+@import "bootstrap/scss/input-group";
+
+// @import "bootstrap/scss/jumbotron";
+// @import "bootstrap/scss/list-group";
+// @import "bootstrap/scss/media";
+@import "bootstrap/scss/modal";
+@import "bootstrap/scss/navbar";
+@import "bootstrap/scss/nav";
+@import "bootstrap/scss/pagination";
+
+// @import "bootstrap/scss/popover";
+@import "bootstrap/scss/print";
+
+// @import "bootstrap/scss/progress";
+@import "bootstrap/scss/reboot";
+@import "bootstrap/scss/root";
+
+// @import "bootstrap/scss/spinners";
+@import "bootstrap/scss/tables";
+
+// @import "bootstrap/scss/toasts";
+@import "bootstrap/scss/tooltip";
+@import "bootstrap/scss/transitions";
+@import "bootstrap/scss/type";
+@import "bootstrap/scss/utilities";
 @import "flatpickr";
 
 /* Koha imports */