Skip to content
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

Material icons node dependency #127

Closed
wants to merge 2 commits into from

Conversation

felixheidecke
Copy link
Contributor

Remove link to fonts.googleapis.com in favor of material-icons node dependency

@felixheidecke
Copy link
Contributor Author

@DeepDiver1975 can you help move the copy process to a nice method in the Makefile? … Pleeeeeeeease 😁

@PVince81
Copy link
Contributor

PVince81 commented May 23, 2018

you need to think in terms of "what is the target file" and "what are the source files" and "what is the command":

+    "compile-theme": "lessc src/themes/owncloud.less core/css/uikit.owncloud.css --relative-urls",
+    "compile-icons": "mkdir core/fonts && cp node_modules/material-icons/iconfont/MaterialIcons-Regular.* core/fonts/ && sass src/themes/icons.scss core/css/material-icons.css --no-source-map"

for compile-themes:

  • target file: core/css/uikit.owncloud.css
  • source file / dependencies: src/themes/owncloud.less
  • process: `lessc $sourcefile $targetfile --relative-urls"

Makefile rule:

core/css/uikit.owncloud.css: src/themes/owncloud.less
    lessc $^ $@ --relative-urls

See https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html

for compile-icons part 1:

  • target file: core/fonts/*
  • source files: node_modules/material-icons/iconfont/MaterialIcons-Regular.*
  • process: copy the source files over

Makefile rule:

core/fonts/: node_modules/material-icons/iconfont/MaterialIcons-Regular.*
    mkdir -p $@ && cp $^ $@

Where $@ is the target "core/fonts" and $^ is the stuff from node_modules

for compile-icons part 2:

  • target file: core/css/material-icons.css
  • source files: src/themes/icons.scss
  • process: run sass

Makefile rule:

core/css/material-icons.css: src/themes/icons.scss
    sass $^ $@  --no-source-map

Then you need to make sure all these run when running regular make, so add more alias rules:

compile-theme: core/css/uikit.owncloud.css
compile-icons: core/fonts/ core/css/material-icons.css

then change the "all:" line and append "compile-theme compile-icons" so these rules run as well in the global make

@PVince81
Copy link
Contributor

next, you need to split npm install in its own rule:

core-deps:
    npm install

then change core rule to just depend on the other rules

core: core-deps compile-icons compile-theme

@DeepDiver1975
Copy link
Member

@felixheidecke conflicting

@felixheidecke felixheidecke force-pushed the material-icons-dependency branch from 8d96068 to 62c5a18 Compare June 14, 2018 17:13
@PVince81
Copy link
Contributor

Fixes #228

@DeepDiver1975 DeepDiver1975 force-pushed the material-icons-dependency branch from 62c5a18 to 0b22d6e Compare September 26, 2018 10:39
Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments

Makefile Outdated
@@ -19,18 +19,28 @@ node_modules: package.json package-lock.json
core/css/uikit.%.css: src/themes/%.less node_modules
node_modules/less/bin/lessc src/themes/$*.less core/css/uikit.$*.css --relative-urls

core/css/material-icons.css: src/themes/icons.scss node_modules
node node_modules/.bin/sass src/themes/icons.scss core/css/material-icons.css --no-source-map
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the node in front of it required ? I thought one can just use directly whatever is in .bin (it might have a shebang)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can replace "core/css/material-icons.css" with $@ which is an alias for the target rule if you like

mkdir core/fonts

core/fonts/MaterialIcons-Regular.%: core/fonts node_modules
cp node_modules/material-icons/iconfont/MaterialIcons-Regular.* core/fonts/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use the placeholder % in the rule name, you need to also use it somewhere here in this command as $*.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well - I basically want all MaterialIcons-Regular.* to be copied over

what would be the best rule to write this?

still asking myself if this is the right approach - can't webpack just grab that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I suspect webpack should be able to grab and even compile some stuff directly without needing extra Makefile rules.

@@ -26,11 +36,11 @@ core/js/core.bundle.js: node_modules
# core
#
.PHONY: core
core: core/js/core.bundle.js core/css/uikit.owncloud.css
core: core/js/core.bundle.js core/css/uikit.owncloud.css core/css/material-icons.css core/fonts/MaterialIcons-Regular.%
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might work only by chance

the "%" placeholder here will never have a value

I suggest just using "core/fonts" as dependency and have all the copying stuff done inside the "core/fonts" rule

@DeepDiver1975
Copy link
Member

@DeepDiver1975
Copy link
Member

@michaelstingl
Copy link
Contributor

@DeepDiver1975
Copy link
Member

@felixheidecke
Copy link
Contributor Author

why not use https://www.npmjs.com/package/vue-material-design-icons ?

The same reason why I don't fancy vueify right now. These would have to be compiled into each app instead of the theme.

@DeepDiver1975
Copy link
Member

Can't we Deal with this by some intelligent bundling?

@scramb scramb mentioned this pull request Nov 13, 2018
9 tasks
@DeepDiver1975 DeepDiver1975 deleted the material-icons-dependency branch November 29, 2018 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants