Skip to content

Commit

Permalink
Use Emotion_hash.Hash.make
Browse files Browse the repository at this point in the history
  • Loading branch information
davesnx committed Aug 17, 2023
1 parent ab61db6 commit 1e7591f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 153 deletions.
9 changes: 0 additions & 9 deletions packages/emotion-hash/_mocked-hash-js/dune
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
(melange.emit
(target dist)
(alias runtest)
(modules hash_js)
(runtime_deps package.json)
(promote (until-clean))
(module_systems
(commonjs js))
(libraries hash))
3 changes: 2 additions & 1 deletion packages/emotion/native/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
(libraries
server-reason-react.js
server-reason-react.belt
styled-ppx.css_native)
styled-ppx.css_native
styled-ppx.emotion-hash)
(wrapped false)
(preprocess
(pps server-reason-react.pipe_first_ppx)))
7 changes: 4 additions & 3 deletions packages/emotion/native/shared/Css.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include Css_native.Css_Colors
include Css_native.Css_Legacy_Core
module Core = Css_native.Css_Legacy_Core


module Autoprefixer = struct
(* Implementation of stylis autoprefixer https://github.com/thysultan/stylis *)
(* This autoprefix works with ">1%, last 4 versions, Firefox ESR, not ie < 9, not dead" from browserlist and not so precise as stylis implementation *)
Expand Down Expand Up @@ -264,18 +265,18 @@ let style (styles : rule list) =
match List.find_map is_label styles with
| None ->
let prefix = "css" in
let hash = Hash.default (rules_to_string styles) in
let hash = Emotion_hash.Hash.make (rules_to_string styles) in
append (Printf.sprintf "%s-%s" prefix hash) styles;
hash
| Some label ->
let prefix = "css" in
let hash = Hash.default (rules_to_string styles) in
let hash = Emotion_hash.Hash.make (rules_to_string styles) in
append (Printf.sprintf "%s-%s-%s" prefix hash label) styles;
hash

let style_debug (styles : rule list) =
print_endline (rules_to_string styles);
let hash = Hash.default (rules_to_string styles) |> String.cat "css-" in
let hash = Emotion_hash.Hash.make (rules_to_string styles) |> String.cat "css-" in
append hash styles;
hash

Expand Down
6 changes: 3 additions & 3 deletions packages/emotion/native/shared/CssJs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -268,18 +268,18 @@ let style (styles : rule array) =
match Array.find_map is_label styles with
| None ->
let prefix = "css" in
let hash = Hash.default (rules_to_string styles) in
let hash = Emotion_hash.Hash.make (rules_to_string styles) in
append (Printf.sprintf "%s-%s" prefix hash) styles;
hash
| Some label ->
let prefix = "css" in
let hash = Hash.default (rules_to_string styles) in
let hash = Emotion_hash.Hash.make (rules_to_string styles) in
append (Printf.sprintf "%s-%s-%s" prefix hash label) styles;
hash

let style_debug (styles : rule array) =
print_endline (rules_to_string styles);
let hash = Hash.default (rules_to_string styles) |> String.cat "css-" in
let hash = Emotion_hash.Hash.make (rules_to_string styles) |> String.cat "css-" in
append hash styles;
hash

Expand Down
135 changes: 0 additions & 135 deletions packages/emotion/native/shared/hash.ml

This file was deleted.

2 changes: 0 additions & 2 deletions packages/emotion/native/shared/hash.mli

This file was deleted.

0 comments on commit 1e7591f

Please sign in to comment.