Пример #1
0
    def test_scss(self):
        s = Site(TEST_SITE)
        s.config.mode = 'prod'
        s.config.plugins = ['hyde.ext.plugins.css.SassyCSSPlugin']
        source = TEST_SITE.child('content/media/css/site.scss')
        target = File(
            Folder(s.config.deploy_root_path).child('media/css/site.css'))
        gen = Generator(s)
        gen.generate_resource_at_path(source)

        assert target.exists
        text = target.read_all()
        expected_text = File(SCSS_SOURCE.child('expected-site.css')).read_all()
        assert_no_diff(expected_text, text)
Пример #2
0
    def test_scss(self):
        s = Site(TEST_SITE)
        s.config.mode = 'prod'
        s.config.plugins = ['hyde.ext.plugins.css.SassyCSSPlugin']
        source = TEST_SITE.child('content/media/css/site.scss')
        target = File(
            Folder(s.config.deploy_root_path).child('media/css/site.css'))
        gen = Generator(s)
        gen.generate_resource_at_path(source)

        assert target.exists
        text = target.read_all()
        expected_text = File(SCSS_SOURCE.child('expected-site.css')).read_all()
        assert_no_diff(expected_text, text)
Пример #3
0
    def test_no_uglify_in_dev_mode(self):
        s = Site(TEST_SITE)
        s.config.plugins = ['hyde.ext.plugins.js.UglifyPlugin']
        s.config.mode = "dev"
        source = TEST_SITE.child('content/media/js/jquery.js')
        target = File(
            Folder(s.config.deploy_root_path).child('media/js/jquery.js'))
        gen = Generator(s)
        gen.generate_resource_at_path(source)

        assert target.exists
        expected = UGLIFY_SOURCE.child_file('jquery.js').read_all()
        # TODO: Very fragile. Better comparison needed.
        text = target.read_all()
        assert_no_diff(expected, text)
Пример #4
0
    def test_no_uglify_in_dev_mode(self):
        s = Site(TEST_SITE)
        s.config.plugins = ['hyde.ext.plugins.js.UglifyPlugin']
        s.config.mode = "dev"
        source = TEST_SITE.child('content/media/js/jquery.js')
        target = File(
            Folder(s.config.deploy_root_path).child('media/js/jquery.js'))
        gen = Generator(s)
        gen.generate_resource_at_path(source)

        assert target.exists
        expected = UGLIFY_SOURCE.child_file('jquery.js').read_all()
        # TODO: Very fragile. Better comparison needed.
        text = target.read_all()
        assert_no_diff(expected, text)
Пример #5
0
    def test_uglify_with_extra_options(self):
        s = Site(TEST_SITE)
        s.config.plugins = ['hyde.ext.plugins.js.UglifyPlugin']
        s.config.mode = "production"
        s.config.uglify = Expando(
            dict(args={"comments": "/http\:\/\/jquery.org\/license/"}))
        source = TEST_SITE.child('content/media/js/jquery.js')
        target = File(
            Folder(s.config.deploy_root_path).child('media/js/jquery.js'))
        gen = Generator(s)
        gen.generate_resource_at_path(source)

        assert target.exists
        expected = UGLIFY_SOURCE.child_file('expected-jquery-nc.js').read_all()
        # TODO: Very fragile. Better comparison needed.
        text = target.read_all()
        assert_no_diff(expected, text)
Пример #6
0
    def test_uglify_with_extra_options(self):
        s = Site(TEST_SITE)
        s.config.plugins = ['hyde.ext.plugins.js.UglifyPlugin']
        s.config.mode = "production"
        s.config.uglify = Expando(
            dict(args={"comments": "/http\:\/\/jquery.org\/license/"}))
        source = TEST_SITE.child('content/media/js/jquery.js')
        target = File(
            Folder(s.config.deploy_root_path).child('media/js/jquery.js'))
        gen = Generator(s)
        gen.generate_resource_at_path(source)

        assert target.exists
        expected = UGLIFY_SOURCE.child_file('expected-jquery-nc.js').read_all()
        # TODO: Very fragile. Better comparison needed.
        text = target.read_all()
        assert_no_diff(expected, text)