-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't find theme.config #6
Comments
If you are using |
Thank you. I'm not going to check |
This is why |
You can use rewrite-import plugin (with webpack): var RewriteImportPlugin = require("less-plugin-rewrite-import"),
options = { plugins: [new RewriteImportPlugin({paths: {
"../../theme.config": "app/less/theme.config"
})] };
less.render(css, options) // app/less/theme.config
@button : 'amazon';
@themesFolder : '~semantic-ui-less/themes';
@siteFolder : '../../app/less/semantic-ui';
@import "~semantic-ui-less/theme.less"; |
The As a temporarily fix I moved |
I had to do with a quick&dirty symlink since I'm using gulp 4 (which Semantic-UI also has a problem with). I don't think we should have to include so much stuff in our repo just to not use the bundled Google font. |
So, did anyone got it really working with a webpack? I stuck where it can't load
The file exists in |
any workaround ? |
@cmnstmntmn I use this gulp task as a workaround: function copyThemeConfig() {
// Semantic looks for a hardcoded theme.config file, so use this hack.
return gulp.src('./frontend/semantic/theme.config')
.pipe(gulp.dest('./node_modules/semantic-ui-less'));
} and in |
my app.less contain original semantic file and altered theme.config @import '~semantic-ui-less/semantic';
@import '~semantic-ui-less/theme.config'; still i get this error
do i miss something? |
@cmnstmntmn Why don't you use the library mentioned in #6 (comment)? |
can't belive it i lost a full day on this crap @hason it doesn't work // Fix Semantic UI
new RewriteImportPlugin({
paths: {
"./node_modules/semantic-ui-less/theme.config.example": "./resources/assets/app/less/theme.config"
}
}), |
@cmnstmntmn It can only override the paths used in less files. For example, you can override https://github.com/Semantic-Org/Semantic-UI-LESS/blob/master/definitions/views/ad.less#L19 new RewriteImportPlugin({
paths: {
"../../theme.config": "./resources/assets/app/less/theme.config"
}
}), |
@hason , so far so good, i still have one more issue with fonts
i added the loaders, but i still get errors { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&mimetype=application/font-woff" },
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }, how did you solved this ? |
I have the same error. If you look at this path, you can tell it's not right:
Should be:
|
I've solved this issue making a on my "scripts": {
"postinstall": "mv ./node_modules/semantic-ui-less/theme.config.example ./node_modules/semantic-ui-less/theme.config"
} This way I can just use SUI on it's default theme. You can Not ideal, but is better then checking |
@dfarr I have the same error - double 'themes' in the path. Having a hard time tracking down why this is the case. Did you ever have any luck figuring it out? |
For anyone else having issues with Webpack + Semantic paths, here is what worked for me.
I have no idea if this is the best way of accomplishing it, but.. it works. Hope it helps someone. |
Well, I do it without copying all of those files to my project, without changing things at node_modules/bower_modules folders and in the end I found it to be a good way to manage things as I can override what I need in my project without all the unnecessary semantic-ui structure. I use laravel-elixir (even though I don't use laravel with my project, I enjoy this tool too much to live without it haha) So I got things like this:
And within my gulpfile.js I added things like this:
As a test to see if things are working (haha what the funny if we can't test it fast?) I change the theme.less file (in the project structure not the one at semantic-ui please) after the "Site theme site.variables" import, I add:
And this is all I do, I can easily upgrade my semantic-ui without copying or hardcoding things at semantic-ui folder or node_modules folder, making things easier to keep and the bad thing about this is that we still need this theme.config file which I only need to change ONE line. |
Thank you so much @jmcclell! I spent this entire afternoon trying to figure this out, and wouldn't have gotten it if it weren't for you. I had to make a slight change for it to work though:
|
@cmnstmntmn What did you end up with? I am trying to use the rewrite plugin for less, that part seems to work. But i have an issue where i cannot resolve the imported module inside of theme.config. |
@blacksails i switched to SUITCSS. i also reccommend you may also have a look at [spectre toolkit].(https://github.com/picturepan2/spectre). no offence to the creators, but this is just another bootstrap |
Webpack users, you could find this article helpful (https://www.artembutusov.com/webpack-semantic-ui/) |
So my solution so far: 1.) Have a
3.) Have the font-var-overwrite in your theme.config (insert at bottom):
|
This is a pretty terrible hack, but here it goes. I added a script to package.json in my project root that does this:
That will cause this module's missing references to |
Why is this done this way? This is really difficult to deal with, e.g. when you're using bundlers that do not support communicating with LESS API. Ant Design does this properly and uses a native LESS feature modifyVars |
Maybe this is somehow helpful. I have made semantic-ui-less work with nuxt.js. https://gist.github.com/citricacid-pl/c1011372618f60c34db704783abcb49d |
Honestly, I'm surprised to see this is still an issue. It's been open since 2015 (over 3 years now), and seems like an easy fix? Just started a new project and we decided to use semantic-ui-less, and this was the first thing I'm hit by. I imagine every person who uses this is also hit by this error. Are there no plans to fix this? Is this project still active? Am I making a mistake by using this? It's a bit worrying, I must admit. |
Can you guys just do the simple fix and make your requires to It's actually not a crazy uncommon pattern for libs to specify a config this way. The main problem is that you're paths are just wrong, and do not allow anyone to write a theme.config while depending on semantic-ui-less through npm. We have to overwrite our node_modules with a hacky postinstall script. Or trick our bundler into aliasing the path. This problem was incredibly annoying with webpack - but eventually I managed to work around it with a resolves.alias. Now I've switched to Parcel - so I'm reliving this problem again, and the only solution is the aforementioned postinstall symbolic linking. Why is semantic-ui-less still doing this clearly nonsensical thing after 3 years of people running into it and all independently coming up with the same horribly hacks to work around it? |
I experienced this and figured out that after following several guides my |
How did you figure out your resolve.alias values? I'm confused because I don't even know where I'm coming from when I do a |
So I've set
semantic-ui-less
as an npm dependancy for my project, I then include@import "semantic-ui-less/semantic.less";
in my project less file and add thetheme.config
file next to it.Run my project gulp file to compile the less and it complains:
Can I not simply include semantic ui as a dependancy rather than having to commit the entire thing?
Confused!
The text was updated successfully, but these errors were encountered: