CSSEx.Parser.parse_file

You're seeing just the function parse_file, go back to CSSEx.Parser module for more information.
Link to this function

parse_file(base_path, file_path)

View Source

Specs

parse_file(path :: String.t(), file_path :: String.t()) ::
  {:ok,
   %CSSEx.Parser{
     answer_to: term(),
     assigns: term(),
     base_path: term(),
     charset: term(),
     column: term(),
     current_add_var: term(),
     current_assign: term(),
     current_chain: term(),
     current_function: term(),
     current_key: term(),
     current_reg: term(),
     current_scope: term(),
     current_value: term(),
     current_var: term(),
     dependencies: term(),
     error: term(),
     ets: term(),
     ets_fontface: term(),
     ets_keyframes: term(),
     expandables: term(),
     expandables_order_map: term(),
     file: term(),
     file_list: term(),
     first_rule: term(),
     font_face: term(),
     font_face_count: term(),
     functions: term(),
     imports: term(),
     keyframes_order_map: term(),
     level: term(),
     line: term(),
     local_assigns: term(),
     local_scope: term(),
     media: term(),
     media_parent: term(),
     no_count: term(),
     order_map: term(),
     page: term(),
     page_parent: term(),
     pass: term(),
     prefix: term(),
     scope: term(),
     search_acc: term(),
     source_pid: term(),
     split_chain: term(),
     supports: term(),
     supports_parent: term(),
     to_file: term(),
     valid?: term(),
     warnings: term()
   }, String.t()}
  | {:error,
     %CSSEx.Parser{
       answer_to: term(),
       assigns: term(),
       base_path: term(),
       charset: term(),
       column: term(),
       current_add_var: term(),
       current_assign: term(),
       current_chain: term(),
       current_function: term(),
       current_key: term(),
       current_reg: term(),
       current_scope: term(),
       current_value: term(),
       current_var: term(),
       dependencies: term(),
       error: String.t(),
       ets: term(),
       ets_fontface: term(),
       ets_keyframes: term(),
       expandables: term(),
       expandables_order_map: term(),
       file: term(),
       file_list: term(),
       first_rule: term(),
       font_face: term(),
       font_face_count: term(),
       functions: term(),
       imports: term(),
       keyframes_order_map: term(),
       level: term(),
       line: term(),
       local_assigns: term(),
       local_scope: term(),
       media: term(),
       media_parent: term(),
       no_count: term(),
       order_map: term(),
       page: term(),
       page_parent: term(),
       pass: term(),
       prefix: term(),
       scope: term(),
       search_acc: term(),
       source_pid: term(),
       split_chain: term(),
       supports: term(),
       supports_parent: term(),
       to_file: term(),
       valid?: false,
       warnings: term()
     }}

Takes a file path to a cssex or css file and parses it into a final CSS representation returning either:

{:ok, %CSSEx.Parser{}, final_binary}
{:error, %CSSEx.Parser{}}

Additionally a %CSSEx.Parser{} struct with prefilled details can be passed as the first argument in which case the parser will use it as its configuration. You can also pass a file path as the last argument and instead of returning the final binary on the :ok tuple it will write the css directly into that file path and return an empty list instead of the final binary

Link to this function

parse_file(data, base_path, file_path)

View Source

Specs

parse_file(
  %CSSEx.Parser{
    answer_to: term(),
    assigns: term(),
    base_path: term(),
    charset: term(),
    column: term(),
    current_add_var: term(),
    current_assign: term(),
    current_chain: term(),
    current_function: term(),
    current_key: term(),
    current_reg: term(),
    current_scope: term(),
    current_value: term(),
    current_var: term(),
    dependencies: term(),
    error: term(),
    ets: term(),
    ets_fontface: term(),
    ets_keyframes: term(),
    expandables: term(),
    expandables_order_map: term(),
    file: term(),
    file_list: term(),
    first_rule: term(),
    font_face: term(),
    font_face_count: term(),
    functions: term(),
    imports: term(),
    keyframes_order_map: term(),
    level: term(),
    line: term(),
    local_assigns: term(),
    local_scope: term(),
    media: term(),
    media_parent: term(),
    no_count: term(),
    order_map: term(),
    page: term(),
    page_parent: term(),
    pass: term(),
    prefix: term(),
    scope: term(),
    search_acc: term(),
    source_pid: term(),
    split_chain: term(),
    supports: term(),
    supports_parent: term(),
    to_file: term(),
    valid?: term(),
    warnings: term()
  }
  | String.t(),
  String.t(),
  String.t()
) ::
  {:ok,
   %CSSEx.Parser{
     answer_to: term(),
     assigns: term(),
     base_path: term(),
     charset: term(),
     column: term(),
     current_add_var: term(),
     current_assign: term(),
     current_chain: term(),
     current_function: term(),
     current_key: term(),
     current_reg: term(),
     current_scope: term(),
     current_value: term(),
     current_var: term(),
     dependencies: term(),
     error: term(),
     ets: term(),
     ets_fontface: term(),
     ets_keyframes: term(),
     expandables: term(),
     expandables_order_map: term(),
     file: term(),
     file_list: term(),
     first_rule: term(),
     font_face: term(),
     font_face_count: term(),
     functions: term(),
     imports: term(),
     keyframes_order_map: term(),
     level: term(),
     line: term(),
     local_assigns: term(),
     local_scope: term(),
     media: term(),
     media_parent: term(),
     no_count: term(),
     order_map: term(),
     page: term(),
     page_parent: term(),
     pass: term(),
     prefix: term(),
     scope: term(),
     search_acc: term(),
     source_pid: term(),
     split_chain: term(),
     supports: term(),
     supports_parent: term(),
     to_file: term(),
     valid?: term(),
     warnings: term()
   }, String.t() | []}
  | {:error,
     %CSSEx.Parser{
       answer_to: term(),
       assigns: term(),
       base_path: term(),
       charset: term(),
       column: term(),
       current_add_var: term(),
       current_assign: term(),
       current_chain: term(),
       current_function: term(),
       current_key: term(),
       current_reg: term(),
       current_scope: term(),
       current_value: term(),
       current_var: term(),
       dependencies: term(),
       error: String.t(),
       ets: term(),
       ets_fontface: term(),
       ets_keyframes: term(),
       expandables: term(),
       expandables_order_map: term(),
       file: term(),
       file_list: term(),
       first_rule: term(),
       font_face: term(),
       font_face_count: term(),
       functions: term(),
       imports: term(),
       keyframes_order_map: term(),
       level: term(),
       line: term(),
       local_assigns: term(),
       local_scope: term(),
       media: term(),
       media_parent: term(),
       no_count: term(),
       order_map: term(),
       page: term(),
       page_parent: term(),
       pass: term(),
       prefix: term(),
       scope: term(),
       search_acc: term(),
       source_pid: term(),
       split_chain: term(),
       supports: term(),
       supports_parent: term(),
       to_file: term(),
       valid?: false,
       warnings: term()
     }}
Link to this function

parse_file(data, base_path, file_path, parse_to_file)

View Source

Specs

parse_file(
  %CSSEx.Parser{
    answer_to: term(),
    assigns: term(),
    base_path: term(),
    charset: term(),
    column: term(),
    current_add_var: term(),
    current_assign: term(),
    current_chain: term(),
    current_function: term(),
    current_key: term(),
    current_reg: term(),
    current_scope: term(),
    current_value: term(),
    current_var: term(),
    dependencies: term(),
    error: term(),
    ets: term(),
    ets_fontface: term(),
    ets_keyframes: term(),
    expandables: term(),
    expandables_order_map: term(),
    file: term(),
    file_list: term(),
    first_rule: term(),
    font_face: term(),
    font_face_count: term(),
    functions: term(),
    imports: term(),
    keyframes_order_map: term(),
    level: term(),
    line: term(),
    local_assigns: term(),
    local_scope: term(),
    media: term(),
    media_parent: term(),
    no_count: term(),
    order_map: term(),
    page: term(),
    page_parent: term(),
    pass: term(),
    prefix: term(),
    scope: term(),
    search_acc: term(),
    source_pid: term(),
    split_chain: term(),
    supports: term(),
    supports_parent: term(),
    to_file: term(),
    valid?: term(),
    warnings: term()
  }
  | nil,
  path :: String.t(),
  file_path :: String.t(),
  output_path :: String.t() | nil
) ::
  {:ok,
   %CSSEx.Parser{
     answer_to: term(),
     assigns: term(),
     base_path: term(),
     charset: term(),
     column: term(),
     current_add_var: term(),
     current_assign: term(),
     current_chain: term(),
     current_function: term(),
     current_key: term(),
     current_reg: term(),
     current_scope: term(),
     current_value: term(),
     current_var: term(),
     dependencies: term(),
     error: term(),
     ets: term(),
     ets_fontface: term(),
     ets_keyframes: term(),
     expandables: term(),
     expandables_order_map: term(),
     file: term(),
     file_list: term(),
     first_rule: term(),
     font_face: term(),
     font_face_count: term(),
     functions: term(),
     imports: term(),
     keyframes_order_map: term(),
     level: term(),
     line: term(),
     local_assigns: term(),
     local_scope: term(),
     media: term(),
     media_parent: term(),
     no_count: term(),
     order_map: term(),
     page: term(),
     page_parent: term(),
     pass: term(),
     prefix: term(),
     scope: term(),
     search_acc: term(),
     source_pid: term(),
     split_chain: term(),
     supports: term(),
     supports_parent: term(),
     to_file: term(),
     valid?: term(),
     warnings: term()
   }, String.t() | []}
  | {:error,
     %CSSEx.Parser{
       answer_to: term(),
       assigns: term(),
       base_path: term(),
       charset: term(),
       column: term(),
       current_add_var: term(),
       current_assign: term(),
       current_chain: term(),
       current_function: term(),
       current_key: term(),
       current_reg: term(),
       current_scope: term(),
       current_value: term(),
       current_var: term(),
       dependencies: term(),
       error: String.t(),
       ets: term(),
       ets_fontface: term(),
       ets_keyframes: term(),
       expandables: term(),
       expandables_order_map: term(),
       file: term(),
       file_list: term(),
       first_rule: term(),
       font_face: term(),
       font_face_count: term(),
       functions: term(),
       imports: term(),
       keyframes_order_map: term(),
       level: term(),
       line: term(),
       local_assigns: term(),
       local_scope: term(),
       media: term(),
       media_parent: term(),
       no_count: term(),
       order_map: term(),
       page: term(),
       page_parent: term(),
       pass: term(),
       prefix: term(),
       scope: term(),
       search_acc: term(),
       source_pid: term(),
       split_chain: term(),
       supports: term(),
       supports_parent: term(),
       to_file: term(),
       valid?: false,
       warnings: term()
     }}