-
Notifications
You must be signed in to change notification settings - Fork 1.4k
URLs in CSS being altered during prod build? #850
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
Comments
I figured out that it's the I'll leave this open for now and you can close it if you like. I hate to add yet more options to the build config, but I wonder if it's worth making the options for |
I am not sure if it is worth it to add another configuration option. The task can be overridden, although it seems like an overhead to override it for such a small change. We need to discuss this further but we may also consider to add support for task specific configuration which can be overridden by developers. // cc @ludohenin |
Task-specific config overrides would be nice, but not sure how well that would work. I already have a number of "project-specific" versions of the original seed tasks to add or modify behavior. So for example, in my I only mention it because I'm not sure how that could be done without actually overriding the whole task. So being able to override some configs in the tasks might cover some scenarios, but there will always be more involved tweaks that will require creating your own task. |
@brian428 is your configuration issue related to those lines https://github.com/mgechev/angular2-seed/blob/master/tools/tasks/seed/build.html_css.ts#L13-L17 ? In this task ( |
What I'm a bit bothered is that our The only problem with overriding tasks is that once the seed gets updated you will not take advantage of the latest changes introduced in the overridden tasks. Not sure if this is such a drawback actually because in the end, the goal of the seed is to be a starter for Angular 2 projects and as developers we're supposed to build on top of it. For this specific case as @ludohenin suggested, we should move the rest of the prefixer's configuration in |
This bit me yesterday also. Wish I had read this, before losing time debugging everything. |
@mgechev, I was just about to write this:
And then realized maybe we actually can! What do you think of using a generic object keyed by plugin to contain any arbitrary plugin configs, and then using a function to look them up in each plugin based on a plugin name key? Consider the current config setup for browsersync. What if it was done like this instead: (In
And then when it is used in
That way:
Which means that developers can add on any configs they want to without Edit: And without having to override a whole task just to alter the config object(s) used. What do you think? |
@brian428 at first glance it looks good to me. |
@brian428 it also might be a good idea to pass a set of default config options to const DEFAULT_CONFIG = {
middleware: [require('connect-history-api-fallback')({index: `${this.APP_BASE}index.html`})],
port: this.PORT
};
let runServer = () => {
browserSync.init(getConfig('browserSync', DEFAULT_CONFIG));
}; And make the signature of function getConfig(taskName: string, defaultConfig?: object) {
const config = ...;
Object.assign(defaultConfig, config);
...
} What do you think? Do you want to take care of the implementation of |
I'll see if I can give this a shot in the next day or two. |
Actually, just curious: any particular reason why you'd want to pass in the default config as an argument to |
…add getPluginConfig() and mergeObject() methods to seed.config.ts; use getPluginConfig() for browser-sync and gulp-concat-css as an initial test. (mgechev#850)
…add getPluginConfig() and mergeObject() methods to seed.config.ts; use getPluginConfig() for browser-sync and gulp-concat-css as an initial test. (mgechev#850)
@mgechev Just checking in to see how you want to proceed on this, since ideally the I can try to take a stab at this, but since I didn't write the tasks and don't have a ton of experience with many of the plugins being used, I'm not sure I'd be the best person to tackle this. Let me know. I just didn't want it to fall off the radar, since the centralized plugin config lookup is really only useful if it is actually used across all of the tasks. |
@brian428 I love the idea to give the tasks some refactoring love! I think it could also be a great opportunity to fix some of those last |
After updating my seed recently, I'm seeing some odd behavior related to relative URLs in some of my CSS files. I'm not sure if this is a bug, but things were fine before I updated to the latest code.
In one of my CSS assets (fontawesome), there are relative URLs like this:
src: url('../fonts/fontawesome-webfont.eot?v=4.6.1');
However, after a prod build, this comes out in my
all.css
file like this:src:url(../../../../src/css/font-awesome/fonts/fontawesome-webfont.eot?v=4.6.1)
Was a task or processor added recently that could be altering these relative URLs?
The text was updated successfully, but these errors were encountered: