@trainoasis @alwaysblank I am still a beginner with Sage and I need to add css files from an external repository that reside outside the assets folder.
I have placed them inside app/customizer/maddisondesigns/customizer-custom-controls. The reason for doing this instead of placing js and css files inside the assets directory is that now I am able to update changes to customizer-custom-controls by just doing a git pull., and also some relative paths are hardcoded inside the css files, which I would need to fix if I modify the file structure. Maybe there is a better option for doing this, but I don’t really know.
I have followed your suggestion, but I can’t make it work:
In config.js I have added a new path:
paths: {
root: rootPath,
assets: path.join(rootPath, 'resources/assets'),
customizer_custom_controls: path.join(rootPath, 'app/customizer/maddisondesigns/customizer-custom-controls/css'),
dist: path.join(rootPath, 'dist'),
},
In my build/webpack.config.json I addded:
{
test: /\.css$/,
include: [config.paths.assets, config.paths.customizer_custom_controls],
use: ExtractTextPlugin.extract({
fallback: 'style',
use: [
{ loader: 'cache' },
{ loader: 'css', options: { sourceMap: config.enabled.sourceMaps } },
{
loader: 'postcss', options: {
config: { path: __dirname, ctx: config },
sourceMap: config.enabled.sourceMaps,
},
},
],
}),
},
I am getting the same error:
ERROR Failed to compile with 2 errors 3:11:32 PM
error in ./app/customizer/maddisondesigns/customizer-custom-controls/css/customizer.css
Module build failed (from /Users/Santos/GoogleDrive/Sites/roots/web/app/themes/restaurant/node_modules/cache-loader/dist/cjs.js):
ModuleParseError: Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
at handleParseError (/Users/Santos/GoogleDrive/Sites/roots/web/app/themes/restaurant/node_modules/webpack/lib/NormalModule.js:469:19)
at /Users/Santos/GoogleDrive/Sites/roots/web/app/themes/restaurant/node_modules/webpack/lib/NormalModule.js:503:5
at /Users/Santos/GoogleDrive/Sites/roots/web/app/themes/restaurant/node_modules/webpack/lib/NormalModule.js:358:12
at /Users/Santos/GoogleDrive/Sites/roots/web/app/themes/restaurant/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/Users/Santos/GoogleDrive/Sites/roots/web/app/themes/restaurant/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at /Users/Santos/GoogleDrive/Sites/roots/web/app/themes/restaurant/node_modules/loader-runner/lib/LoaderRunner.js:205:4
at /Users/Santos/GoogleDrive/Sites/roots/web/app/themes/restaurant/node_modules/webpack/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:85:15
at processTicksAndRejections (internal/process/task_queues.js:79:11)
Am I missing something?
Thanks for the help