Giter Club home page Giter Club logo

lektor-htmlmin's People

Contributors

mountainash avatar nomorepanic avatar runeh avatar xavitorello avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lektor-htmlmin's Issues

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0'

Minification of files created using other encoding than UTF8 raises:

Traceback (most recent call last):
  File "$LEKTOR_PATHH/devserver.py", line 45, in build
    builder.build_all()
  File "$LEKTOR_PATHH/builder.py", line 1111, in build_all
    self.env.plugin_controller.emit('after-build-all', builder=self)
  File "$LEKTOR_PATHH/pluginsystem.py", line 161, in emit
    rv[plugin.id] = handler(**kwargs)
  File "$LEKTOR_TMP_PATHH/lektor_htmlmin.py", line 58, in on_after_build_all    self.minify_file(htmlfile)
  File "$LEKTOR_TMP_PATHH/lektor_htmlmin.py", line 44, in minify_file
    result = htmlmin.minify(f.read().decode('latin-1'), **self.options)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 78: ordinal not in range(128)

unable to install 1.0

Following the instructions in the README and running lektor plugins add lektor-htmlmin results in lektor-htmlmin version 0.1.10 getting installed, not 1.0, at least on my non-linux-x86_64 system. (The same outdated version gets installed when I pip install lektor-htmlmin too.) Looking at https://pypi.python.org/pypi/lektor-htmlmin, the only source distribution available is "lektor-htmlmin-1.0.linux-x86_64.tar.gz", so I take it that the source distribution was mistakenly marked as x86_64-only, even though this package is classified as "Operating System :: OS Independent".

ResourceWarning: unclosed file

Getting lots of these errors:

Object allocated at (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/lektor_htmlmin.py", lineno 46
    html = open(target, 'rb').read()
/usr/local/lib/python3.8/site-packages/lektor_htmlmin.py:46: ResourceWarning: unclosed file <_io.BufferedReader name='/srv/lektor/builds/en/.../index.html'>
  html = open(target, 'rb').read()

I'm thinking that the io read needs to close before continuing to the next file.
Ref: https://docs.python.org/3/library/io.html#io.IOBase.close

Broken with Lektor 3.0 ?

Thanx for this plugin.

Using the latest (=today) git version of Lektor (marked as 3.0) seems to break your plugin :

Traceback (most recent call last):
  File "/Users/odeckmyn/Work/BioPredictive/IT/github/biopredictive-website/_venv/bin/lektor", line 11, in <module>
    load_entry_point('Lektor==3.0', 'console_scripts', 'lektor’)()
  File "/Users/odeckmyn/Work/BioPredictive/IT/github/biopredictive-website/_venv/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Users/odeckmyn/Work/BioPredictive/IT/github/biopredictive-website/_venv/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/Users/odeckmyn/Work/BioPredictive/IT/github/biopredictive-website/_venv/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/odeckmyn/Work/BioPredictive/IT/github/biopredictive-website/_venv/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/odeckmyn/Work/BioPredictive/IT/github/biopredictive-website/_venv/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Users/odeckmyn/Work/BioPredictive/IT/github/biopredictive-website/_venv/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/Users/odeckmyn/Work/BioPredictive/IT/github/biopredictive-website/_venv/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Users/odeckmyn/Work/BioPredictive/IT/github/biopredictive-website/_venv/lib/python2.7/site-packages/lektor/cli.py", line 221, in build_cmd
    success = _build()
  File "/Users/odeckmyn/Work/BioPredictive/IT/github/biopredictive-website/_venv/lib/python2.7/site-packages/lektor/cli.py", line 214, in _build
    failures = builder.build_all()
  File "/Users/odeckmyn/Work/BioPredictive/IT/github/biopredictive-website/_venv/lib/python2.7/site-packages/lektor/builder.py", line 1130, in build_all
    self.env.plugin_controller.emit('after-build-all', builder=self)
  File "/Users/odeckmyn/Work/BioPredictive/IT/github/biopredictive-website/_venv/lib/python2.7/site-packages/lektor/pluginsystem.py", line 160, in emit
    rv[plugin.id] = handler(**kwargs)
  File "/Users/odeckmyn/Library/Caches/Lektor/packages/a6bc7908ecb482f98ad1094d25407fb2/lektor_htmlmin.py", line 56, in on_after_build_all
    if not self.is_enabled(builder.build_flags):
AttributeError: 'Builder' object has no attribute ‘build_flags’
make: *** [build.website] Error 1

Thanx for your help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.