diff --git a/.circleci/config.yml b/.circleci/config.yml index cd95c0d615c4..ca401c52e6c3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,11 +42,14 @@ jobs: name: Pim database installation command: docker-compose exec fpm bin/console --env=behat pim:install --force --clean - run: - name: Pim yarn dev installation - command: docker-compose run --rm node yarn run webpack-dev + name: Pim yarn less installation + command: docker-compose run --rm node yarn run less - run: - name: Pim yarn test installation - command: docker-compose run --rm node yarn run webpack-test + name: Pim yarn dev installation + command: docker-compose run --rm node yarn run webpack-dev + - run: + name: Pim yarn test installation + command: docker-compose run --rm node yarn run webpack-test - run: name: Change owner on project dir after installing when there is no cache command: sudo chmod -R 777 ../project diff --git a/UPGRADE.md b/UPGRADE.md index fe2c9d70adbe..a610c40b2bb7 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -79,7 +79,7 @@ To give you a quick overview of the changes made to a standard project, you can ```bash export PIM_DIR=/path/to/your/current/pim/installation ``` - + Then apply the changes: ```bash @@ -104,11 +104,11 @@ To give you a quick overview of the changes made to a standard project, you can * The configuration file `app/config/security.yml` had somes changes: - ... - + * The configuration file `app/config/pim_parameters.yml` had some changes: - ... - + * The configuration file `app/config/security_test.yml` had some changes: - ... @@ -123,9 +123,9 @@ To give you a quick overview of the changes made to a standard project, you can ``` Or you can follow the detailed list of changes: - + - ... - + 5. Update your **app/config/config_prod.yml** An easy way to update it is to copy/paste from the latest standard edition and add your custom changes. @@ -136,9 +136,9 @@ To give you a quick overview of the changes made to a standard project, you can ``` Or you can update the file with the following changes: - + - ... - + 6. Update your **app/config/routing.yml** An easy way to update it is to copy/paste from the latest standard edition and add your custom changes. @@ -152,33 +152,33 @@ To give you a quick overview of the changes made to a standard project, you can * The following route configurations have been removed: - `old_route` - + * The following route configurations have been added: - + v3.1: ```yaml route_name: resource: "@YOUR_NEW_BUNDLE/config/routing/routing.yml" ``` - + * The following route configurations have been updated: - + - route_name - + v3.0.x: ```yaml route_name: resource: "@YOUR_OLD_BUNDLE/config/routing/routing.yml" ``` - + to - + v3.1: ```yaml route_name: resource: "@YOUR_NEW_BUNDLE/config/routing/routing.yml" ``` - + 7. Update your **app/AppKernel.php**: An easy way to update it is to copy/paste from the latest standard edition and add your own bundles in the `registerProjectBundles` method. @@ -210,39 +210,39 @@ Before updating the dependencies and migrating your data, please deactivate all 11. Update your dependencies: The easiest way to update your `composer.json` is to copy/paste from the latest standard edition and add your custom dependencies. - + ```bash cp composer.json $PIM_DIR/ # then add your own dependencies ``` - + The easiest way to update your `package.json` is to copy/paste from the latest standard edition and add your custom dependencies. - + ```bash cp package.json $PIM_DIR/ # then add your own dependencies ``` - + Now we are ready to update the backend dependencies: - + ```bash cd $PIM_DIR php -d memory_limit=3G composer update ``` - + **This step will copy the upgrades folder from `pim-community-dev/` to your Pim project root in order to migrate.** If you have custom code in your project, this step may raise errors in the "post-script" command. In this case, go to the chapter "Migrate your custom code" before running the database migration. And we also have to update the frontend dependencies: - + ```bash yarn install ``` -12. Migrate your MySQL database: +12. Migrate your MySQL database: - Please, make sure the folder `upgrades/schema/` does not contain former migration files (from PIM 3.0 to 3.1 for instance), + Please, make sure the folder `upgrades/schema/` does not contain former migration files (from PIM 3.0 to 3.1 for instance), otherwise the migration command will surely not work properly. ```bash @@ -260,10 +260,34 @@ Before updating the dependencies and migrating your data, please deactivate all TO_FILL_WITH_NEW_SCRIPTS ``` -14. Then re-generate the PIM assets: +14. Migrate your .less assets + + If you have defined a Resources/config/assets.yml file in any of your bundles to import .less files, you must move these imports to a new file at Resources/public/less/index.less to import your styles instead. + + For example + + Before in `Resources/config/assets.yml` + ```yml + css: + lib: + - bundles/yourbundle/assets/less/styles.css + - bundles/yourbundle/assets/less/bundle.less + ``` + + After in `Resources/public/less/index.less` + + ```less + @import (less) "./web/bundles/yourbundle/assets/less/styles.css"; + @import "./web/bundles/yourbundle/assets/less/bundle.less"; + ``` + + If you are importing a .css file, you must add `(less)` after the import, as above. If you only have .less files in your bundle's assets.yml, you can remove it. + +15. Then re-generate the PIM assets: ```bash bin/console pim:installer:assets --clean --env=prod + yarn run less yarn run webpack ``` diff --git a/app/AppKernel.php b/app/AppKernel.php index 27c267ef12aa..ededea56dfa4 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -132,7 +132,6 @@ protected function getSymfonyBundles() new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), - new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), @@ -164,7 +163,6 @@ protected function getOroDependencies() protected function getOroBundles() { return [ - new Oro\Bundle\AsseticBundle\OroAsseticBundle(), new Oro\Bundle\ConfigBundle\OroConfigBundle(), new Oro\Bundle\DataGridBundle\OroDataGridBundle(), new Oro\Bundle\FilterBundle\OroFilterBundle(), diff --git a/app/config/config.yml b/app/config/config.yml index d5c2fae4fc90..5b7133173c16 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -39,13 +39,6 @@ twig: globals: uservoice_key: "%uservoice_key%" -# Assetic Configuration -assetic: - debug: "%kernel.debug%" - use_controller: false - filters: - cssrewrite: ~ - # Swiftmailer Configuration swiftmailer: transport: "%mailer_transport%" diff --git a/app/config/config_behat.yml b/app/config/config_behat.yml index 5b65cc9bce76..5c50589af5cb 100644 --- a/app/config/config_behat.yml +++ b/app/config/config_behat.yml @@ -29,9 +29,6 @@ monolog: swiftmailer: disable_delivery: true -assetic: - use_controller: false - pim_import_export: record_mails: true diff --git a/app/config/config_dev.yml b/app/config/config_dev.yml index 2cf9fe0c082f..5b30a0f19f32 100644 --- a/app/config/config_dev.yml +++ b/app/config/config_dev.yml @@ -23,9 +23,5 @@ monolog: type: console channels: ['!event', '!doctrine'] -oro_assetic: - css_debug: ~ - css_debug_all: false - swiftmailer: disable_delivery: true diff --git a/app/config/config_prod.yml b/app/config/config_prod.yml index 68a5510fd7cd..87acc0dd3d0a 100644 --- a/app/config/config_prod.yml +++ b/app/config/config_prod.yml @@ -23,7 +23,3 @@ monolog: level: info console: type: console - -oro_assetic: - css_debug: ~ - css_debug_all: false diff --git a/app/config/config_test.yml b/app/config/config_test.yml index 3faa115e1d35..b3f5a2aa0be9 100644 --- a/app/config/config_test.yml +++ b/app/config/config_test.yml @@ -18,9 +18,6 @@ web_profiler: swiftmailer: disable_delivery: true -assetic: - use_controller: false - parameters: max_products_category_removal: 20 installer_data: PimInstallerBundle:minimal diff --git a/bin/docker/pim-front.sh b/bin/docker/pim-front.sh index 16596e5a0584..58e38d246cb6 100755 --- a/bin/docker/pim-front.sh +++ b/bin/docker/pim-front.sh @@ -4,5 +4,6 @@ docker-compose exec fpm rm -rf var/cache/* docker-compose exec fpm bin/console --env=prod pim:installer:assets --symlink --clean +docker-compose run --rm node yarn run less docker-compose run --rm node yarn run webpack-dev docker-compose run --rm node yarn run webpack-test diff --git a/bin/docker/pim-initialize.sh b/bin/docker/pim-initialize.sh index 83c1355ba0bd..a32ee5a3fc50 100755 --- a/bin/docker/pim-initialize.sh +++ b/bin/docker/pim-initialize.sh @@ -5,5 +5,6 @@ docker-compose exec fpm rm -rf var/cache/* docker-compose exec fpm bin/console --env=prod pim:install --force --symlink --clean docker-compose exec fpm bin/console --env=behat pim:installer:db +docker-compose run --rm node yarn run less docker-compose run --rm node yarn run webpack-dev docker-compose run --rm node yarn run webpack-test diff --git a/bin/pim-front.sh b/bin/pim-front.sh index 865c4307ddc9..a71e9990b1bc 100755 --- a/bin/pim-front.sh +++ b/bin/pim-front.sh @@ -5,5 +5,6 @@ rm -rf ./web/js rm -rf ./web/css bin/console --env=prod pim:installer:assets --symlink --clean +yarn run less yarn run webpack-dev yarn run webpack-test diff --git a/composer.json b/composer.json index 91a4adbd8c6c..81a1f45797bf 100644 --- a/composer.json +++ b/composer.json @@ -50,8 +50,6 @@ "friendsofsymfony/rest-bundle": "2.1.1", "gedmo/doctrine-extensions":"v2.4.26", "incenteev/composer-parameter-handler": "2.1.2", - "kriswallsmith/assetic": "1.4.0", - "leafo/lessphp": "0.5.0", "league/flysystem": "1.0.40", "league/flysystem-ziparchive": "1.0.3", "liip/imagine-bundle": "1.9.1", @@ -63,7 +61,6 @@ "sensio/distribution-bundle": "5.0.20", "sensio/framework-extra-bundle": "3.0.26", "sensio/generator-bundle": "3.1.6", - "symfony/assetic-bundle": "2.8.2", "symfony/monolog-bundle": "3.1.2", "symfony/swiftmailer-bundle": "3.0.3", "symfony/security-acl": "3.0.0", @@ -102,7 +99,6 @@ "oro/translation-bundle": "1.0-dev", "oro/navigation-bundle": "1.0-dev", "oro/security-bundle": "1.0-dev", - "oro/assetic-bundle": "1.0-dev", "oro/filter-bundle": "1.0-dev", "oro/config-bundle": "1.0-dev", "oro/user-bundle": "1.0-dev", diff --git a/webpack/check-dependencies.js b/frontend/build/check-dependencies.js similarity index 100% rename from webpack/check-dependencies.js rename to frontend/build/check-dependencies.js diff --git a/frontend/build/compile-less.js b/frontend/build/compile-less.js new file mode 100644 index 000000000000..907f3146c39f --- /dev/null +++ b/frontend/build/compile-less.js @@ -0,0 +1,108 @@ +require('colors') +const { dirname, resolve } = require('path') +const { writeFileSync, readFileSync, existsSync } = require('fs') +const rootDir = process.cwd() +const isDev = process.argv && process.argv.indexOf('--dev') > -1; +const lessc = require('less') + +// A plugin to rewrite the image urls +const RewriteImageURLs = require('./less-rewrite-urls') + +// The file that contains the paths of all required bundles of the PIM +const BUNDLE_REQUIRE_PATH = resolve(rootDir, './web/js/require-paths') + +// The file path for each bundle that imports all the .less files +const BUNDLE_LESS_INDEX_PATH = 'public/less/index.less' + +// The final output path for all the CSS of the PIM +const OUTPUT_CSS_PATH = 'web/css/pim.css' + +if (!existsSync(`${BUNDLE_REQUIRE_PATH}.js`)) { + console.error(`web/js/require-paths.js does not exist - Run "bin/console pim:installer:dump-require-paths" and try again.`.red) + + process.exit(1) +} + +const bundlePaths = require(BUNDLE_REQUIRE_PATH) + +/** + * Get the file contents of a given path as a string + * + * @param {string} filePath + */ +function getFileContents(filePath) { + try { + const fileContents = readFileSync(filePath, 'utf-8') + console.log(`‣ ${filePath}`.blue) + return fileContents + } catch (e) { } +} + +/** + * Return the contents of each index.less file from each bundle + * + * @param {array} bundlePaths An array of directories of each required bundle + */ +function collectBundleImports(bundlePaths) { + // Make each path relative + const indexFiles = bundlePaths.map(bundlePath => { + return dirname(bundlePath) + .replace('config', BUNDLE_LESS_INDEX_PATH) + .replace(/(^.+)[^vendor](?=\/src|\/vendor)\//gm, '') + }) + + const bundleImports = [] + + console.log('\nStarting LESS compilation\n'.green) + + for (filePath of indexFiles) { + bundleImports.push(getFileContents(filePath)) + } + + console.log('\n') + return bundleImports.join('') +} + +/** + * Format a lessjs compilation error + * + * @param {Error} error A LESS error coming from the lessjs parser + */ +function formatParseError(error) { + console.log(`Error compiling less: ${error.message}\n\n`.red, `${error.filename}:${error.line}:${error.column}`.yellow) + console.log(error.extract.map(line => `>${line}\n`.red).join('')) +} + +/** + * Write the final CSS output into a file + * + * @param {String} css The combined CSS from each bundle + */ +function writeCSSOutput(css) { + try { + writeFileSync(resolve(rootDir, OUTPUT_CSS_PATH), css, 'utf-8') + console.log(`✓ Saved CSS to ${OUTPUT_CSS_PATH}`.green) + } catch (e) { + console.log(`❌ Error writing CSS ${e.message}`.red) + } +} + +lessc.render(collectBundleImports(bundlePaths), { + sourceMap: { + sourceMapFileInline: isDev + }, + compress: true, + plugins: [new RewriteImageURLs({ + // Remove the 'web' part of the image/font urls + replace: [{ + search: './web/bundles', + replace: '/bundles' + }] + })] +}).then( + output => writeCSSOutput(output.css), + error => { + formatParseError(error) + process.exit(1) + }) + .catch(error => console.log('Error', error)) diff --git a/frontend/build/less-rewrite-urls.js b/frontend/build/less-rewrite-urls.js new file mode 100644 index 000000000000..6488360024da --- /dev/null +++ b/frontend/build/less-rewrite-urls.js @@ -0,0 +1,45 @@ +function getProcessor(less) { + function Processor(options) { + this.options = options || { replace: [] }; + this._visitor = new less.visitors.Visitor(this); + } + + Processor.prototype = { + run: function (root) { + return this._visitor.visit(root); + }, + visitUrl: function (URLNode, visitArgs) { + let path = URLNode.value.value; + + if (!path) return URLNode; + + if (typeof URLNode.value._fileInfo !== "undefined") { + const containsURL = new RegExp("^([a-zA-Z]+\:\/\/|\/|data\:).+"); + if (!containsURL.test(URLNode.value.value)) { + path = URLNode.value._fileInfo.currentDirectory + path; + } + } + + this.options.replace.forEach(function(repl) { + let pattern = new RegExp(repl.search, "g"); + path = path.replace(pattern, repl.replace) + }); + + URLNode.value.value = path; + + return URLNode; + } + }; + return Processor; +}; + +function RewriteImageURLs(options) { + return { + install(less, pluginManager) { + const Processor = getProcessor(less); + pluginManager.addVisitor(new Processor(options)); + } + } +} + +module.exports = RewriteImageURLs; diff --git a/webpack/test/acceptance/generate-html-report.js b/frontend/test/acceptance/generate-html-report.js similarity index 100% rename from webpack/test/acceptance/generate-html-report.js rename to frontend/test/acceptance/generate-html-report.js diff --git a/webpack/test/acceptance/run-steps.js b/frontend/test/acceptance/run-steps.js similarity index 100% rename from webpack/test/acceptance/run-steps.js rename to frontend/test/acceptance/run-steps.js diff --git a/webpack/config-loader.js b/frontend/webpack/config-loader.js similarity index 100% rename from webpack/config-loader.js rename to frontend/webpack/config-loader.js diff --git a/webpack/require-context.js b/frontend/webpack/require-context.js similarity index 100% rename from webpack/require-context.js rename to frontend/webpack/require-context.js diff --git a/webpack/require-polyfill.js b/frontend/webpack/require-polyfill.js similarity index 100% rename from webpack/require-polyfill.js rename to frontend/webpack/require-polyfill.js diff --git a/webpack/requirejs-utils.js b/frontend/webpack/requirejs-utils.js similarity index 95% rename from webpack/requirejs-utils.js rename to frontend/webpack/requirejs-utils.js index fcb50e423c69..38ed5e0e210e 100644 --- a/webpack/requirejs-utils.js +++ b/frontend/webpack/requirejs-utils.js @@ -67,8 +67,8 @@ const utils = { const pathSourceFile = require(sourcePath); const { config, paths } = utils.getRequireConfig(pathSourceFile, baseDir); const aliases = Object.assign(paths, getFrontModules(process.cwd(), './web/bundles')(), { - 'require-polyfill': path.resolve(sourceDir, './webpack/require-polyfill.js'), - 'require-context': path.resolve(sourceDir, './webpack/require-context.js'), + 'require-polyfill': path.resolve(sourceDir, './frontend/webpack/require-polyfill.js'), + 'require-context': path.resolve(sourceDir, './frontend/webpack/require-context.js'), 'module-registry': path.resolve(baseDir, './web/js/module-registry.js'), routes: path.resolve(baseDir, './web/js/routes.js'), 'fos-routing-base': path.resolve(baseDir, './vendor/friendsofsymfony/jsrouting-bundle/Resources/public/js/router.js'), diff --git a/package.json b/package.json index 97ce17526762..3c49509c2d6c 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,10 @@ "lint-fix": "node ./node_modules/eslint/bin/eslint 'src/**/*.js' --ignore-path .eslintignore --quiet --fix", "unit": "jest --no-cache --config tests/front/unit/jest/unit.jest.js", "integration": "jest --no-cache --config ./tests/front/integration/jest/integration.jest.js", - "acceptance": "cucumber-js --tags @acceptance-front -r ./webpack/test/acceptance/run-steps.js -r ./tests/front/acceptance/cucumber", - "acceptance-html-report": "yarn run acceptance ./tests/features/ -f json:web/test_dist/acceptance-js.json && node webpack/test/acceptance/generate-html-report.js" + "acceptance": "cucumber-js --tags @acceptance-front -r ./frontend/test/acceptance/run-steps.js -r ./tests/front/acceptance/cucumber", + "acceptance-html-report": "yarn run acceptance ./tests/features/ -f json:web/test_dist/acceptance-js.json && node frontend/test/acceptance/generate-html-report.js", + "less": "node ./frontend/build/compile-less.js", + "less-watch": "SHELL=/bin/bash chokidar --verbose \"{src,web/bundles}/**/*.{less,css}\" -c \"yarn run less --dev\"" }, "repository": { "type": "git", @@ -57,6 +59,7 @@ "babel-preset-env": "1.6.0", "backbone": "0.9.10", "bundle-loader": "0.5.5", + "chokidar-cli": "^1.2.1", "deepmerge": "1.5.1", "dropzone": "4.0.1", "eslint": "4.5.0", @@ -64,6 +67,7 @@ "expose-loader": "0.7.3", "imports-loader": "0.7.1", "jquery": "3.3.1", + "less": "^3.9.0", "loader-utils": "1.1.0", "lodash": "4.17.4", "merge-objects": "1.0.5", diff --git a/src/Akeneo/Platform/Bundle/InstallerBundle/Command/AssetsCommand.php b/src/Akeneo/Platform/Bundle/InstallerBundle/Command/AssetsCommand.php index cd5d09881f19..fd361ef505e1 100644 --- a/src/Akeneo/Platform/Bundle/InstallerBundle/Command/AssetsCommand.php +++ b/src/Akeneo/Platform/Bundle/InstallerBundle/Command/AssetsCommand.php @@ -81,8 +81,6 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->getEventDispatcher()->dispatch(InstallerEvents::POST_SYMFONY_ASSETS_DUMP, $event); $this->commandExecutor - ->runCommand('assetic:dump') - ->runCommand('oro:assetic:dump') ->runCommand('pim:installer:dump-require-paths') ->runCommand('pim:installer:dump-extensions'); $defaultLocales = $this->getContainer()->getParameter('pim_localization.provider.ui_locale.locale_codes'); diff --git a/src/Akeneo/Platform/Bundle/UIBundle/Resources/config/assets.yml b/src/Akeneo/Platform/Bundle/UIBundle/Resources/config/assets.yml deleted file mode 100644 index 8cf6f39278e7..000000000000 --- a/src/Akeneo/Platform/Bundle/UIBundle/Resources/config/assets.yml +++ /dev/null @@ -1,114 +0,0 @@ -css: - lib: - - bundles/pimui/lib/bootstrap/less/bootstrap.less - - bundles/pimui/lib/font-awesome/css/font-awesome.css - - bundles/pimui/lib/bootstrap-switch/bootstrap.switch.css - - bundles/pimui/lib/bootstrap-datetimepicker/css/bootstrap-datepicker.css - - bundles/pimui/lib/select2/select2.css - - bundles/pimui/lib/slimbox2/slimbox2.css - - bundles/pimui/lib/summernote/summernote.css - - lib_customization: - - bundles/pimui/less/lib/bootstrap.switch.less - - bundles/pimui/less/lib/bootstrap.dropdown.less - - bundles/pimui/less/lib/dialog.less - - bundles/pimui/less/lib/dropdown.less - - bundles/pimui/less/lib/flags.less - - bundles/pimui/less/lib/font-awesome.less - - bundles/pimui/less/lib/jquery.jstree.less - - bundles/pimui/less/lib/jquery-ui.less - - bundles/pimui/less/lib/jquery.multiselect.less - - bundles/pimui/less/lib/jquery.sidebarize.less - - bundles/pimui/less/lib/modal.less - - bundles/pimui/less/lib/navs.less - - bundles/pimui/less/lib/select2.less - - bundles/pimui/less/lib/slimbox2.less - - bundles/pimui/less/lib/tabs.less - - bundles/pimui/less/lib/wizard.less - - bundles/pimui/less/lib/select2.less - - bundles/pimui/less/lib/summernote.less - - bem: - - bundles/pimui/less/base/general.less - - - bundles/pimui/less/components/button/ActionButton.less - - bundles/pimui/less/components/button/Button.less - - bundles/pimui/less/components/button/ButtonList.less - - bundles/pimui/less/components/button/DropdownButton.less - - bundles/pimui/less/components/button/IconButton.less - - bundles/pimui/less/components/button/SecondaryActions.less - - bundles/pimui/less/components/button/SelectButton.less - - bundles/pimui/less/components/button/SeveralActionsButton.less - - - bundles/pimui/less/components/grid/FilterBox.less - - bundles/pimui/less/components/grid/FilterChoice.less - - bundles/pimui/less/components/grid/Grid.less - - bundles/pimui/less/components/grid/GridContainer.less - - bundles/pimui/less/components/grid/GridToolbar.less - - bundles/pimui/less/components/grid/MassActions.less - - - bundles/pimui/less/components/product-edit-form/AssetCollectionField.less - - bundles/pimui/less/components/product-edit-form/AssetPreview.less - - bundles/pimui/less/components/product-edit-form/AttributeActions.less - - bundles/pimui/less/components/product-edit-form/ChoicesField.less - - bundles/pimui/less/components/product-edit-form/CommentPanel.less - - bundles/pimui/less/components/product-edit-form/CompletenessPanel.less - - bundles/pimui/less/components/product-edit-form/ComparableFields.less - - bundles/pimui/less/components/product-edit-form/FieldContainer.less - - bundles/pimui/less/components/product-edit-form/FormContainer.less - - bundles/pimui/less/components/product-edit-form/HorizontalNavtab.less - - bundles/pimui/less/components/product-edit-form/MediaField.less - - bundles/pimui/less/components/product-edit-form/MetricField.less - - bundles/pimui/less/components/product-edit-form/PriceList.less - - bundles/pimui/less/components/product-edit-form/SelectField.less - - bundles/pimui/less/components/product-edit-form/TabHeader.less - - bundles/pimui/less/components/product-edit-form/TextareaField.less - - bundles/pimui/less/components/product-edit-form/TextField.less - - bundles/pimui/less/components/product-edit-form/VariantNavigation.less - - bundles/pimui/less/components/product-edit-form/VerticalNavtab.less - - - bundles/pimui/less/components/Acl.less - - bundles/pimui/less/components/Badge.less - - bundles/pimui/less/components/Breadcrumb.less - - bundles/pimui/less/components/Caret.less - - bundles/pimui/less/components/CenteredBox.less - - bundles/pimui/less/components/OptionEditor.less - - bundles/pimui/less/components/Checkbox.less - - bundles/pimui/less/components/Column.less - - bundles/pimui/less/components/ColumnConfigurator.less - - bundles/pimui/less/components/DescriptionHeader.less - - bundles/pimui/less/components/Diff.less - - bundles/pimui/less/components/Dropdown.less - - bundles/pimui/less/components/Flash.less - - bundles/pimui/less/components/Footer.less - - bundles/pimui/less/components/Header.less - - bundles/pimui/less/components/Image.less - - bundles/pimui/less/components/InfoBlock.less - - bundles/pimui/less/components/List.less - - bundles/pimui/less/components/LoadingMask.less - - bundles/pimui/less/components/MessageBox.less - - bundles/pimui/less/components/Notification.less - - bundles/pimui/less/components/NotificationList.less - - bundles/pimui/less/components/NotificationMenu.less - - bundles/pimui/less/components/Progress.less - - bundles/pimui/less/components/ProjectWidget.less - - bundles/pimui/less/components/Rule.less - - bundles/pimui/less/components/Search.less - - bundles/pimui/less/components/SequentialEdit.less - - bundles/pimui/less/components/SquareList.less - - bundles/pimui/less/components/State.less - - bundles/pimui/less/components/Steps.less - - bundles/pimui/less/components/Subsection.less - - bundles/pimui/less/components/QuickEdit.less - - bundles/pimui/less/components/TabContainer.less - - bundles/pimui/less/components/Thumbnail.less - - bundles/pimui/less/components/TitleContainer.less - - bundles/pimui/less/components/Switch.less - - bundles/pimui/less/components/VerticalList.less - - bundles/pimui/less/components/Widget.less - - bundles/pimui/less/components/FamilyVariant.less - - bundles/pimui/less/components/CatalogVolume.less - - - bundles/pimui/less/pages/Default.less - - bundles/pimui/less/pages/FullPage.less - - bundles/pimui/less/pages/Login.less diff --git a/src/Akeneo/Platform/Bundle/UIBundle/Resources/config/twig.yml b/src/Akeneo/Platform/Bundle/UIBundle/Resources/config/twig.yml index 8d54ce8680c0..19357e72f62d 100644 --- a/src/Akeneo/Platform/Bundle/UIBundle/Resources/config/twig.yml +++ b/src/Akeneo/Platform/Bundle/UIBundle/Resources/config/twig.yml @@ -73,7 +73,6 @@ services: arguments: - '@pim_catalog.command_launcher' - '@request_stack' - - '%assetic.write_to%' tags: - { name: twig.extension } diff --git a/src/Akeneo/Platform/Bundle/UIBundle/Resources/public/less/components/product-edit-form/FieldContainer.less b/src/Akeneo/Platform/Bundle/UIBundle/Resources/public/less/components/product-edit-form/FieldContainer.less index c064fa589614..306a1357a2ea 100644 --- a/src/Akeneo/Platform/Bundle/UIBundle/Resources/public/less/components/product-edit-form/FieldContainer.less +++ b/src/Akeneo/Platform/Bundle/UIBundle/Resources/public/less/components/product-edit-form/FieldContainer.less @@ -8,7 +8,7 @@ &--packed { margin-bottom: 5px; - &:first-of-type() { + &:first-of-type { margin-top: 20px; } } diff --git a/src/Akeneo/Platform/Bundle/UIBundle/Resources/public/less/index.less b/src/Akeneo/Platform/Bundle/UIBundle/Resources/public/less/index.less new file mode 100644 index 000000000000..3952c2b1188d --- /dev/null +++ b/src/Akeneo/Platform/Bundle/UIBundle/Resources/public/less/index.less @@ -0,0 +1,111 @@ +@import "./web/bundles/pimui/lib/bootstrap/less/bootstrap.less"; +@import (less) "./web/bundles/pimui/lib/font-awesome/css/font-awesome.css"; +@import (less) "./web/bundles/pimui/lib/bootstrap-switch/bootstrap.switch.css"; +@import (less) "./web/bundles/pimui/lib/bootstrap-datetimepicker/css/bootstrap-datepicker.css"; +@import (less) "./web/bundles/pimui/lib/select2/select2.css"; +@import (less) "./web/bundles/pimui/lib/slimbox2/slimbox2.css"; +@import (less) "./web/bundles/pimui/lib/summernote/summernote.css"; + +@import "./web/bundles/pimui/less/lib/bootstrap.switch.less"; +@import "./web/bundles/pimui/less/lib/bootstrap.dropdown.less"; +@import "./web/bundles/pimui/less/lib/dialog.less"; +@import "./web/bundles/pimui/less/lib/dropdown.less"; +@import "./web/bundles/pimui/less/lib/flags.less"; +@import "./web/bundles/pimui/less/lib/font-awesome.less"; +@import "./web/bundles/pimui/less/lib/jquery.jstree.less"; +@import "./web/bundles/pimui/less/lib/jquery-ui.less"; +@import "./web/bundles/pimui/less/lib/jquery.multiselect.less"; +@import "./web/bundles/pimui/less/lib/jquery.sidebarize.less"; +@import "./web/bundles/pimui/less/lib/modal.less"; +@import "./web/bundles/pimui/less/lib/navs.less"; +@import "./web/bundles/pimui/less/lib/select2.less"; +@import "./web/bundles/pimui/less/lib/slimbox2.less"; +@import "./web/bundles/pimui/less/lib/tabs.less"; +@import "./web/bundles/pimui/less/lib/wizard.less"; +@import "./web/bundles/pimui/less/lib/select2.less"; +@import "./web/bundles/pimui/less/lib/summernote.less"; + + +@import "./web/bundles/pimui/less/base/general.less"; + +@import "./web/bundles/pimui/less/components/button/ActionButton.less"; +@import "./web/bundles/pimui/less/components/button/Button.less"; +@import "./web/bundles/pimui/less/components/button/ButtonList.less"; +@import "./web/bundles/pimui/less/components/button/DropdownButton.less"; +@import "./web/bundles/pimui/less/components/button/IconButton.less"; +@import "./web/bundles/pimui/less/components/button/SecondaryActions.less"; +@import "./web/bundles/pimui/less/components/button/SelectButton.less"; +@import "./web/bundles/pimui/less/components/button/SeveralActionsButton.less"; + +@import "./web/bundles/pimui/less/components/grid/FilterBox.less"; +@import "./web/bundles/pimui/less/components/grid/FilterChoice.less"; +@import "./web/bundles/pimui/less/components/grid/Grid.less"; +@import "./web/bundles/pimui/less/components/grid/GridContainer.less"; +@import "./web/bundles/pimui/less/components/grid/GridToolbar.less"; +@import "./web/bundles/pimui/less/components/grid/MassActions.less"; + +@import "./web/bundles/pimui/less/components/product-edit-form/AssetCollectionField.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/AssetPreview.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/AttributeActions.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/ChoicesField.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/CommentPanel.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/CompletenessPanel.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/ComparableFields.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/FieldContainer.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/FormContainer.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/HorizontalNavtab.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/MediaField.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/MetricField.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/PriceList.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/SelectField.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/TabHeader.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/TextareaField.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/TextField.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/VariantNavigation.less"; +@import "./web/bundles/pimui/less/components/product-edit-form/VerticalNavtab.less"; + +@import "./web/bundles/pimui/less/components/Acl.less"; +@import "./web/bundles/pimui/less/components/Badge.less"; +@import "./web/bundles/pimui/less/components/Breadcrumb.less"; +@import "./web/bundles/pimui/less/components/Caret.less"; +@import "./web/bundles/pimui/less/components/CenteredBox.less"; +@import "./web/bundles/pimui/less/components/OptionEditor.less"; +@import "./web/bundles/pimui/less/components/Checkbox.less"; +@import "./web/bundles/pimui/less/components/Column.less"; +@import "./web/bundles/pimui/less/components/ColumnConfigurator.less"; +@import "./web/bundles/pimui/less/components/DescriptionHeader.less"; +@import "./web/bundles/pimui/less/components/Diff.less"; +@import "./web/bundles/pimui/less/components/Dropdown.less"; +@import "./web/bundles/pimui/less/components/Flash.less"; +@import "./web/bundles/pimui/less/components/Footer.less"; +@import "./web/bundles/pimui/less/components/Header.less"; +@import "./web/bundles/pimui/less/components/Image.less"; +@import "./web/bundles/pimui/less/components/InfoBlock.less"; +@import "./web/bundles/pimui/less/components/List.less"; +@import "./web/bundles/pimui/less/components/LoadingMask.less"; +@import "./web/bundles/pimui/less/components/MessageBox.less"; +@import "./web/bundles/pimui/less/components/Notification.less"; +@import "./web/bundles/pimui/less/components/NotificationList.less"; +@import "./web/bundles/pimui/less/components/NotificationMenu.less"; +@import "./web/bundles/pimui/less/components/Progress.less"; +@import "./web/bundles/pimui/less/components/ProjectWidget.less"; +@import "./web/bundles/pimui/less/components/Rule.less"; +@import "./web/bundles/pimui/less/components/Search.less"; +@import "./web/bundles/pimui/less/components/SequentialEdit.less"; +@import "./web/bundles/pimui/less/components/SquareList.less"; +@import "./web/bundles/pimui/less/components/State.less"; +@import "./web/bundles/pimui/less/components/Steps.less"; +@import "./web/bundles/pimui/less/components/Subsection.less"; +@import "./web/bundles/pimui/less/components/QuickEdit.less"; +@import "./web/bundles/pimui/less/components/TabContainer.less"; +@import "./web/bundles/pimui/less/components/Thumbnail.less"; +@import "./web/bundles/pimui/less/components/TitleContainer.less"; +@import "./web/bundles/pimui/less/components/Switch.less"; +@import "./web/bundles/pimui/less/components/VerticalList.less"; +@import "./web/bundles/pimui/less/components/Widget.less"; +@import "./web/bundles/pimui/less/components/FamilyVariant.less"; +@import "./web/bundles/pimui/less/components/CatalogVolume.less"; + +@import "./web/bundles/pimui/less/pages/Default.less"; +@import "./web/bundles/pimui/less/pages/FullPage.less"; +@import "./web/bundles/pimui/less/pages/Login.less"; diff --git a/src/Akeneo/Platform/Bundle/UIBundle/Resources/public/lib/jstree/themes/default/style.css b/src/Akeneo/Platform/Bundle/UIBundle/Resources/public/lib/jstree/themes/default/style.css index edcaf9a74332..084d32c2339e 100644 --- a/src/Akeneo/Platform/Bundle/UIBundle/Resources/public/lib/jstree/themes/default/style.css +++ b/src/Akeneo/Platform/Bundle/UIBundle/Resources/public/lib/jstree/themes/default/style.css @@ -4,7 +4,7 @@ * Supported plugins: ui (hovered, clicked), checkbox, contextmenu, search */ -.jstree-default li, +.jstree-default li, .jstree-default ins { background-image:url("d.png"); background-repeat:no-repeat; background-color:transparent; } .jstree-default li { background-position:-90px 0; background-repeat:repeat-y; } .jstree-default li.jstree-last { background:transparent; } @@ -22,7 +22,7 @@ .jstree-default.jstree-focused { } -.jstree-default .jstree-no-dots li, +.jstree-default .jstree-no-dots li, .jstree-default .jstree-no-dots .jstree-leaf > ins { background:transparent; } .jstree-default .jstree-no-dots .jstree-open > ins { background-position:-18px 0; } .jstree-default .jstree-no-dots .jstree-closed > ins { background-position:0 0; } @@ -48,22 +48,22 @@ .jstree-default a.jstree-search { color:aqua; } .jstree-default .jstree-locked a { color:silver; cursor:default; } -#vakata-contextmenu.jstree-default-context, +#vakata-contextmenu.jstree-default-context, #vakata-contextmenu.jstree-default-context li ul { background:#f0f0f0; border:1px solid #979797; -moz-box-shadow: 1px 1px 2px #999; -webkit-box-shadow: 1px 1px 2px #999; box-shadow: 1px 1px 2px #999; } #vakata-contextmenu.jstree-default-context li { } #vakata-contextmenu.jstree-default-context a { color:black; } -#vakata-contextmenu.jstree-default-context a:hover, +#vakata-contextmenu.jstree-default-context a:hover, #vakata-contextmenu.jstree-default-context .vakata-hover > a { padding:0 5px; background:#e8eff7; border:1px solid #aecff7; color:black; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; } -#vakata-contextmenu.jstree-default-context li.jstree-contextmenu-disabled a, +#vakata-contextmenu.jstree-default-context li.jstree-contextmenu-disabled a, #vakata-contextmenu.jstree-default-context li.jstree-contextmenu-disabled a:hover { color:silver; background:transparent; border:0; padding:1px 4px; } #vakata-contextmenu.jstree-default-context li.vakata-separator { background:white; border-top:1px solid #e0e0e0; margin:0; } #vakata-contextmenu.jstree-default-context li ul { margin-left:-4px; } /* IE6 BEGIN */ -.jstree-default li, +.jstree-default li, .jstree-default ins, -#vakata-dragged.jstree-default .jstree-invalid, -#vakata-dragged.jstree-default .jstree-ok, +#vakata-dragged.jstree-default .jstree-invalid, +#vakata-dragged.jstree-default .jstree-ok, #jstree-marker.jstree-default { _background-image:url("d.gif"); } .jstree-default .jstree-open ins { _background-position:-72px 0; } .jstree-default .jstree-closed ins { _background-position:-54px 0; } @@ -74,4 +74,4 @@ .jstree-default .jstree-undetermined a .jstree-checkbox { _background-position:-20px -19px; } .jstree-default .jstree-checked a .jstree-checkbox { _background-position:-38px -19px; } .jstree-default .jstree-unchecked a .jstree-checkbox { _background-position:-2px -19px; } -/* IE6 END */ \ No newline at end of file +/* IE6 END */ diff --git a/src/Akeneo/Platform/Bundle/UIBundle/Twig/TranslationsExtension.php b/src/Akeneo/Platform/Bundle/UIBundle/Twig/TranslationsExtension.php index 439c179c9c78..33a5684f5103 100644 --- a/src/Akeneo/Platform/Bundle/UIBundle/Twig/TranslationsExtension.php +++ b/src/Akeneo/Platform/Bundle/UIBundle/Twig/TranslationsExtension.php @@ -23,22 +23,16 @@ class TranslationsExtension extends \Twig_Extension /** @var RequestStack */ protected $requestStack; - /** @var string */ - protected $asseticRoot; - /** * @param CommandLauncher $commandLauncher * @param RequestStack $requestStack - * @param string $asseticRoot */ public function __construct( CommandLauncher $commandLauncher, - RequestStack $requestStack, - $asseticRoot + RequestStack $requestStack ) { $this->commandLauncher = $commandLauncher; $this->requestStack = $requestStack; - $this->asseticRoot = $asseticRoot; } /** @@ -60,7 +54,7 @@ public function getFunctions() public function getTranslationsFile() { $localeCode = $this->getLocale(); - $relativeFilePath = sprintf('%s/js/translation/%s.js', $this->asseticRoot, $localeCode); + $relativeFilePath = sprintf('web/js/translation/%s.js', $localeCode); $absoluteFilePath = realpath($relativeFilePath); if (!file_exists($absoluteFilePath)) { diff --git a/src/Akeneo/Platform/config/bundles/assetic.yml b/src/Akeneo/Platform/config/bundles/assetic.yml deleted file mode 100644 index 0770ba5ec4f7..000000000000 --- a/src/Akeneo/Platform/config/bundles/assetic.yml +++ /dev/null @@ -1,13 +0,0 @@ -assetic: - bundles: - - OroAsseticBundle - - PimUserBundle - - PimUIBundle - - AkeneoChannelBundle - - AkeneoPimEnrichmentBundle - - AkeneoPimStructureBundle - - PimNotificationBundle - filters: - lessphp: - file: '%kernel.root_dir%/../vendor/leafo/lessphp/lessc.inc.php' - apply_to: \.less$ diff --git a/src/Akeneo/Platform/config/pim.yml b/src/Akeneo/Platform/config/pim.yml index 5f3ee94cd4e9..054f3f43ee71 100644 --- a/src/Akeneo/Platform/config/pim.yml +++ b/src/Akeneo/Platform/config/pim.yml @@ -1,7 +1,6 @@ imports: - { resource: 'bundles/akeneo_batch.yml' } - { resource: 'bundles/akeneo_api.yml' } - - { resource: 'bundles/assetic.yml' } - { resource: 'bundles/doctrine.yml' } - { resource: 'bundles/fos_auth_server.yml' } - { resource: 'bundles/fos_js_routing.yml' } diff --git a/src/Akeneo/UserManagement/Bundle/Resources/views/layout.html.twig b/src/Akeneo/UserManagement/Bundle/Resources/views/layout.html.twig index 4e7ea33207fe..dd73b76b842b 100644 --- a/src/Akeneo/UserManagement/Bundle/Resources/views/layout.html.twig +++ b/src/Akeneo/UserManagement/Bundle/Resources/views/layout.html.twig @@ -9,7 +9,7 @@ {% block head_style %} - {% include 'OroAsseticBundle:Assets:oro_css.html.twig' %} + {% endblock %} {% endblock %} diff --git a/src/Oro/Bundle/AsseticBundle/Command/OroAsseticDumpCommand.php b/src/Oro/Bundle/AsseticBundle/Command/OroAsseticDumpCommand.php deleted file mode 100644 index fd8bd05b8e05..000000000000 --- a/src/Oro/Bundle/AsseticBundle/Command/OroAsseticDumpCommand.php +++ /dev/null @@ -1,142 +0,0 @@ -setName('oro:assetic:dump') - ->setDescription('Dumps oro assetics') - ->addArgument('show-groups', InputArgument::OPTIONAL, 'Show list of css groups') - ->addArgument('write_to', InputArgument::OPTIONAL, 'Override the configured asset root'); - } - - protected function initialize(InputInterface $input, OutputInterface $output) - { - $this->basePath = $input->getArgument('write_to') ? : $this->getContainer()->getParameter('assetic.write_to'); - $this->am = $this->getContainer()->get('oro_assetic.asset_manager'); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - if ($input->getArgument('show-groups') !== null) { - $output->writeln('Get list of css groups'); - $this->getGroupList($output); - } else { - $output->writeln(sprintf('Dumping all %s assets.', $input->getOption('env'))); - $output->writeln(sprintf('Debug mode is %s.', 'off')); - $output->writeln(''); - - $this->dumpAssets($output); - } - } - - protected function getGroupList($output) - { - $assets = $this->am->getAssetGroups(); - $compiledGroups = $this->am->getCompiledGroups(); - - $output->writeln(''); - $output->writeln('Css groups:'); - $this->writeGroups($assets['css'], $compiledGroups['css'], $output); - } - - protected function writeGroups($groups, $compiledGroups, $output) - { - foreach ($groups as $group) { - if (in_array($group, $compiledGroups)) { - $output->writeln( - sprintf( - '%s (compiled)', - $group - ) - ); - } else { - $output->writeln( - sprintf( - '%s', - $group - ) - ); - } - } - } - - /** - * Dump files - * @param $output - */ - protected function dumpAssets($output) - { - foreach ($this->am->getAssets() as $asset) { - /** @var $asset \Oro\Bundle\AsseticBundle\Node\OroAsseticNode */ - $this->doDump($asset->getCompressAsset(), $output); - } - } - - /** - * @param AssetInterface $asset - * @param OutputInterface $output - * @throws \RuntimeException - */ - private function doDump(AssetInterface $asset, OutputInterface $output) - { - foreach ($this->getAssetVarCombinations($asset) as $combination) { - $asset->setValues($combination); - - // resolve the target path - $target = rtrim($this->basePath, '/') . '/' . $asset->getTargetPath(); - $target = str_replace('_controller/', '', $target); - $target = VarUtils::resolve($target, $asset->getVars(), $asset->getValues()); - - if (!is_dir($dir = dirname($target))) { - $output->writeln( - sprintf( - '%s [dir+] %s', - date('H:i:s'), - $dir - ) - ); - - if (false === @mkdir($dir, 0777, true)) { - throw new \RuntimeException('Unable to create directory ' . $dir); - } - } - - $output->writeln( - sprintf( - '%s [file+] %s', - date('H:i:s'), - $target - ) - ); - - if (false === @file_put_contents($target, $asset->dump())) { - throw new \RuntimeException('Unable to write file ' . $target); - } - } - } - - private function getAssetVarCombinations(AssetInterface $asset) - { - return VarUtils::getCombinations( - $asset->getVars(), - $this->getContainer()->getParameter('assetic.variables') - ); - } -} diff --git a/src/Oro/Bundle/AsseticBundle/DependencyInjection/Configuration.php b/src/Oro/Bundle/AsseticBundle/DependencyInjection/Configuration.php deleted file mode 100644 index bb01e361eca9..000000000000 --- a/src/Oro/Bundle/AsseticBundle/DependencyInjection/Configuration.php +++ /dev/null @@ -1,28 +0,0 @@ -root('oro_assetic'); - - $rootNode - ->children() - ->arrayNode('css_debug') - ->prototype('scalar')->end() - ->end() - ->booleanNode('css_debug_all')->defaultValue(false)->end() - ->end(); - - return $treeBuilder; - } -} diff --git a/src/Oro/Bundle/AsseticBundle/DependencyInjection/OroAsseticExtension.php b/src/Oro/Bundle/AsseticBundle/DependencyInjection/OroAsseticExtension.php deleted file mode 100644 index 97cf42ca40bf..000000000000 --- a/src/Oro/Bundle/AsseticBundle/DependencyInjection/OroAsseticExtension.php +++ /dev/null @@ -1,101 +0,0 @@ -processConfiguration($configuration, $configs); - - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('services.yml'); - - $container->setParameter('oro_assetic.assets', $this->getAssets($container, $config)); - } - - /** - * Get alias - * - * @return string - */ - public function getAlias() - { - return 'oro_assetic'; - } - - /** - * Get array with assets from config files - * - * @param ContainerBuilder $container - * @param $config - * @return array - */ - public function getAssets(ContainerBuilder $container, $config) - { - $bundles = $container->getParameter('kernel.bundles'); - - $css = []; - - foreach ($bundles as $bundle) { - $reflection = new \ReflectionClass($bundle); - if (is_file($file = dirname($reflection->getFilename()) . '/Resources/config/assets.yml')) { - $bundleConfig = Yaml::parse(file_get_contents(realpath($file))); - if (isset($bundleConfig['css'])) { - $css = array_merge_recursive($css, $bundleConfig['css']); - } - } - } - - $container->setParameter( - 'oro_assetic.assets_groups', - [ - 'css' => array_keys($css) - ] - ); - - $container->setParameter( - 'oro_assetic.compiled_assets_groups', - [ - 'css' => $config['css_debug'] - ] - ); - - return [ - 'css' => $this->getAssetics($css, $config['css_debug'], $config['css_debug_all']), - ]; - } - - protected function getAssetics($assetsArray, $debugBlocks, $debugAll) - { - $compressAssets = []; - $uncompressAssets = []; - foreach ($assetsArray as $blockName => $files) { - if ($debugAll || in_array($blockName, $debugBlocks)) { - $uncompressAssets = array_merge($uncompressAssets, $files); - } else { - $compressAssets = array_merge($compressAssets, $files); - } - } - - return [ - 'compress' => [$compressAssets], - 'uncompress' => [$uncompressAssets] - ]; - } -} diff --git a/src/Oro/Bundle/AsseticBundle/Factory/OroAssetManager.php b/src/Oro/Bundle/AsseticBundle/Factory/OroAssetManager.php deleted file mode 100644 index 871d86fcb938..000000000000 --- a/src/Oro/Bundle/AsseticBundle/Factory/OroAssetManager.php +++ /dev/null @@ -1,158 +0,0 @@ -am = $am; - $this->twig = $twig; - $this->assetGroups = $assetGroups; - $this->compiledGroups = $compiledGroups; - } - - /** - * @return array - */ - public function getAssetGroups() - { - return $this->assetGroups; - } - - /** - * @return array - */ - public function getCompiledGroups() - { - return $this->compiledGroups; - } - - /** - * @return OroAsseticNode[] - */ - public function getAssets() - { - $this->load(); - - return $this->assets; - } - - /** - * @param $name - * @return mixed - */ - public function get($name) - { - $this->load(); - - return $this->assets[$name]->getUnCompressAsset(); - } - - /** - * @param $name - * @return bool - */ - public function has($name) - { - $this->load(); - - return isset($this->assets[$name]); - } - - /** - * Load assets - */ - public function load() - { - if (null === $this->assets) { - $this->assets = $this->loadAssets(); - } - } - - /** - * Analyze resources and collect nodes of OroAsseticNode - * - * @return OroAsseticNode[] - */ - protected function loadAssets() - { - $result = []; - - foreach ($this->am->getResources() as $resources) { - if (!$resources instanceof IteratorResourceInterface) { - $resources = [$resources]; - } - - /**@var $resource FileResource */ - foreach ($resources as $resource) { - $tokens = $this->twig->tokenize($resource->getContent(), (string)$resource); - $nodes = $this->twig->parse($tokens); - $result += $this->loadNode($nodes); - } - } - - return $result; - } - - /** - * Loads assets from the supplied node. - * - * @param \Twig_Node $node - * - * @return array An array of asset formulae indexed by name - */ - private function loadNode(\Twig_Node $node) - { - $assets = []; - if ($node instanceof OroAsseticNode) { - $assets[$node->getNameUnCompress()] = $node; - } - - foreach ($node as $child) { - if ($child instanceof \Twig_Node) { - $assets += $this->loadNode($child); - } - } - - return $assets; - } -} diff --git a/src/Oro/Bundle/AsseticBundle/Node/OroAsseticNode.php b/src/Oro/Bundle/AsseticBundle/Node/OroAsseticNode.php deleted file mode 100644 index 2ed75c953a2f..000000000000 --- a/src/Oro/Bundle/AsseticBundle/Node/OroAsseticNode.php +++ /dev/null @@ -1,168 +0,0 @@ -nameCompress = $names['compress']; - $this->nameUnCompress = $names['un_compress']; - $this->compressedAsset = $assets['compress']; - $this->unCompressAsset = $assets['un_compress']; - - $nodes = ['body' => $body]; - - $attributes = array_replace( - ['debug' => null, 'combine' => null, 'var_name' => 'asset_url'], - $attributes, - ['inputs' => $inputs, 'filters' => $filters] - ); - - $this->nodes = $nodes; - $this->attributes = $attributes; - $this->lineno = $lineno; - $this->tag = $tag; - } - - /** - * @return AssetInterface - */ - public function getUnCompressAsset() - { - return $this->unCompressAsset; - } - - /** - * @return AssetInterface - */ - public function getCompressAsset() - { - return $this->compressedAsset; - } - - /** - * @return array - */ - public function getNameUnCompress() - { - return $this->nameUnCompress; - } - - /** - * {@inheritDoc} - */ - public function compile(\Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); - - - $this->compileAsset($compiler, $this->compressedAsset, $this->nameCompress); - $this->compileDebug($compiler); - - $compiler - ->write('unset($context[') - ->repr($this->getAttribute('var_name')) - ->raw("]);\n"); - } - - /** - * @param \Twig_Compiler $compiler - */ - protected function compileDebug(\Twig_Compiler $compiler) - { - $i = 0; - foreach ($this->unCompressAsset as $leaf) { - $leafName = $this->nameUnCompress . '_' . $i++; - $this->compileAsset($compiler, $leaf, $leafName); - } - } - - /** - * @param \Twig_Compiler $compiler - * @param AssetInterface $asset - * @param $name - */ - protected function compileAsset(\Twig_Compiler $compiler, AssetInterface $asset, $name) - { - $compiler - ->write("// asset \"$name\"\n") - ->write('$context[') - ->repr($this->getAttribute('var_name')) - ->raw('] = '); - - if ($this->compressedAsset == $asset) { - $this->compileCombineDebugAssetUrl($compiler, $asset->getTargetPath(), $name); - } else { - $inputs = $this->getAttribute('inputs'); - if (!in_array($asset->getSourcePath(), $inputs['uncompress'][0])) { - $this->compileAssetUrl($compiler, $asset, $name); - } else { - $this->compileCombineDebugAssetUrl($compiler, $asset->getSourcePath(), $name); - } - } - - $compiler - ->raw(";\n") - ->subcompile($this->getNode('body')); - } - - /** - * @param \Twig_Compiler $compiler - * @param string $path - * @param $name - */ - protected function compileCombineDebugAssetUrl(\Twig_Compiler $compiler, $path, $name) - { - $compiler->raw('$this->env->getExtension(\'asset\')->getAssetUrl(') - ->repr($path) - ->raw(')'); - } - - /** - * @param \Twig_Compiler $compiler - * @param AssetInterface $asset - * @param $name - */ - protected function compileAssetUrl(\Twig_Compiler $compiler, AssetInterface $asset, $name) - { - $compiler->subcompile($this->getPathFunction($name)); - } - - /** - * @param $name - * @return \Twig_Node_Expression_Function - */ - private function getPathFunction($name) - { - return new \Twig_Node_Expression_Function( - version_compare(\Twig_Environment::VERSION, '1.2.0-DEV', '<') - ? new \Twig_Node_Expression_Name('path', $this->getTemplateLine()) : 'path', - new \Twig_Node([new \Twig_Node_Expression_Constant('_assetic_' . $name, $this->getTemplateLine())]), - $this->getTemplateLine() - ); - } -} diff --git a/src/Oro/Bundle/AsseticBundle/OroAsseticBundle.php b/src/Oro/Bundle/AsseticBundle/OroAsseticBundle.php deleted file mode 100644 index b69b6c1cbe50..000000000000 --- a/src/Oro/Bundle/AsseticBundle/OroAsseticBundle.php +++ /dev/null @@ -1,9 +0,0 @@ -assets = $assets; - $this->factory = $factory; - $this->tag = $tag; - $this->output = $output; - } - - /** - * {@inheritDoc} - */ - public function parse(\Twig_Token $token) - { - $inputs = $this->assets; - - $filters = []; - $attributes = [ - 'output' => $this->output, - 'var_name' => 'asset_url', - 'vars' => [], - ]; - - $stream = $this->parser->getStream(); - - while (!$stream->test(\Twig_Token::BLOCK_END_TYPE)) { - if ($stream->test(\Twig_Token::NAME_TYPE, 'filter')) { - $filters = array_merge( - $filters, - array_filter(array_map('trim', explode(',', $this->parseValue($stream, false)))) - ); - } elseif ($stream->test(\Twig_Token::NAME_TYPE, 'output')) { - $attributes['output'] = $this->parseValue($stream, false); - } elseif ($stream->test(\Twig_Token::NAME_TYPE, 'debug')) { - $attributes['debug'] = $this->parseValue($stream); - } elseif ($stream->test(\Twig_Token::NAME_TYPE, 'combine')) { - $attributes['combine'] = $this->parseValue($stream); - } else { - $token = $stream->getCurrent(); - throw new \Twig_Error_Syntax( - sprintf( - 'Unexpected token "%s" of value "%s"', - \Twig_Token::typeToEnglish($token->getType(), $token->getLine()), - $token->getValue() - ), - $token->getLine() - ); - } - } - - $stream->expect(\Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse([$this, 'testEndTag'], true); - $stream->expect(\Twig_Token::BLOCK_END_TYPE); - - $nameUnCompress = $this->factory->generateAssetName($inputs['compress'][0], $filters, $attributes); - $nameCompress = substr(sha1(serialize($inputs['uncompress'][0]) . 'oro_assets'), 0, 7); - - return new OroAsseticNode( - [ - 'compress' => $this->factory->createAsset( - $inputs['compress'][0], - $filters, - $attributes + ['name' => $nameCompress, 'debug' => false] - ), - 'un_compress' => $this->factory->createAsset( - $inputs['uncompress'][0], - [], - $attributes + ['name' => $nameUnCompress, 'debug' => true] - ) - ], - [ - 'un_compress' => $nameUnCompress, - 'compress' => $nameCompress - ], - $filters, - $inputs, - $body, - $attributes, - $token->getLine(), - $this->getTag() - ); - } - - /** - * {@inheritDoc} - */ - public function getTag() - { - return $this->tag; - } - - /** - * Test for end tag - * - * @param \Twig_Token $token - * - * @return bool - */ - public function testEndTag(\Twig_Token $token) - { - return $token->test(['end' . $this->tag]); - } - - /** - * Get value from stream - * - * @param \Twig_TokenStream $stream - * @param bool $isBool - * - * @return bool|string - */ - protected function parseValue(\Twig_TokenStream $stream, $isBool = true) - { - $stream->next(); - $stream->expect(\Twig_Token::OPERATOR_TYPE, '='); - - if ($isBool) { - return 'true' == $stream->expect(\Twig_Token::NAME_TYPE, ['true', 'false'])->getValue(); - } - - return $stream->expect(\Twig_Token::STRING_TYPE)->getValue(); - } -} diff --git a/src/Oro/Bundle/AsseticBundle/README.md b/src/Oro/Bundle/AsseticBundle/README.md deleted file mode 100644 index 530c49a5d912..000000000000 --- a/src/Oro/Bundle/AsseticBundle/README.md +++ /dev/null @@ -1,66 +0,0 @@ -OroAsseticBundle -======================== - -OroAssetic enables expandable and optimized way to manage CSS assets that are distributed across many bundles. -With OroAssetic developer can define CSS and JavaScript files groups in assets.yml configuration of the bundle. Defined -files will be automatically merged and optimized for web presentation. For development and debug purposes some files can -be excluded from optimization process. - - -Example of assets.yml file: -```yaml -css: - 'css_group': - - 'Assets/Path/To/Css/first.css' - - 'Assets/Path/To/Css/second.css' - - 'Assets/Path/To/Css/third.css' -``` - -Css section contain groups of files. This groups can be excluded from optimization process debugging purposes. - -The path to file can be defined as @BundleName/Resources/puclic/path/to/file.ext or bundles/bundle/path/to/file.ext. -If the file path contains @, then in debug mode it will be taken via controller. If path doesn't contain @, then file -will be taken via request to web folder. - -For example, to turn off compression of css files in 'css_group' group the following configuration should be added -to app/config/config.yml (or app/config/config_{mode}.yml) file: - -```yaml -oro_assetic: - css_debug: [css_group] -``` -In order to enable debug mode for all CSS files following configuration can be applied: - -```yaml -oro_assetic: - css_debug_all: true -``` - -Cache cleanup and Oro assetics dump required after: - -```php -php app/console cache:clear -php app/console oro:assetic:dump -``` - - -To get list of all available asset groups next command should be used: - -```php -php app/console oro:assetic:dump show-groups -``` - -The next code must be added in main template: - -``` - {% oro_css filter='array with filters' output='css/name_of_output_file.css' %} - - {% endoro_css %} -``` -These tags are the same as assetics "stylesheet" tags but without list of files. - -To compile blocks of files into single file, there is command - -``` -php app/console oro:assetic:dump -``` diff --git a/src/Oro/Bundle/AsseticBundle/Resources/config/placeholders.yml b/src/Oro/Bundle/AsseticBundle/Resources/config/placeholders.yml deleted file mode 100644 index c2087a6a5ac6..000000000000 --- a/src/Oro/Bundle/AsseticBundle/Resources/config/placeholders.yml +++ /dev/null @@ -1,9 +0,0 @@ -placeholders: - head_style: - items: - assets_css: - order: 100 - -items: - assets_css: - template: OroAsseticBundle:Assets:oro_css.html.twig \ No newline at end of file diff --git a/src/Oro/Bundle/AsseticBundle/Resources/config/services.yml b/src/Oro/Bundle/AsseticBundle/Resources/config/services.yml deleted file mode 100644 index 1a0f04535e24..000000000000 --- a/src/Oro/Bundle/AsseticBundle/Resources/config/services.yml +++ /dev/null @@ -1,22 +0,0 @@ -parameters: - oro_assetic.twig_extension.class: Oro\Bundle\AsseticBundle\Twig\AsseticExtension - oro_assetic.asset_manager.class: Oro\Bundle\AsseticBundle\Factory\OroAssetManager - -services: - oro_assetic.asset_manager: - class: '%oro_assetic.asset_manager.class%' - arguments: - - '@assetic.asset_manager' - - '@twig' - - '%oro_assetic.assets_groups%' - - '%oro_assetic.compiled_assets_groups%' - - oro_assetic.twig.extension: - class: '%oro_assetic.twig_extension.class%' - arguments: - - '@assetic.asset_factory' - - '%oro_assetic.assets%' - - '@templating.name_parser' - - '%assetic.bundles%' - tags: - - { name: twig.extension } diff --git a/src/Oro/Bundle/AsseticBundle/Resources/public/lib/less-1.3.3.min.js b/src/Oro/Bundle/AsseticBundle/Resources/public/lib/less-1.3.3.min.js deleted file mode 100644 index 9b0fa6bae3bb..000000000000 --- a/src/Oro/Bundle/AsseticBundle/Resources/public/lib/less-1.3.3.min.js +++ /dev/null @@ -1,9 +0,0 @@ -// -// LESS - Leaner CSS v1.3.3 -// http://lesscss.org -// -// Copyright (c) 2009-2013, Alexis Sellier -// Licensed under the Apache 2.0 License. -// -(function(e,t){function n(t){return e.less[t.split("/")[1]]}function f(){r.env==="development"?(r.optimization=0,r.watchTimer=setInterval(function(){r.watchMode&&g(function(e,t,n,r,i){t&&S(t.toCSS(),r,i.lastModified)})},r.poll)):r.optimization=3}function m(){var e=document.getElementsByTagName("style");for(var t=0;t0&&(s.splice(o-1,2),o-=2)}return i.hostPart=r[1],i.directories=s,i.path=r[1]+s.join("/"),i.fileUrl=i.path+(r[4]||""),i.url=i.fileUrl+(r[5]||""),i}function w(t,n,i,s){var o=t.contents||{},u=t.files||{},a=b(t.href,e.location.href),f=a.url,c=l&&l.getItem(f),h=l&&l.getItem(f+":timestamp"),p={css:c,timestamp:h},d;r.relativeUrls?r.rootpath?t.entryPath?d=b(r.rootpath+y(a.path,t.entryPath)).path:d=r.rootpath:d=a.path:r.rootpath?d=r.rootpath:t.entryPath?d=t.entryPath:d=a.path,x(f,t.type,function(e,l){v+=e.replace(/@import .+?;/ig,"");if(!i&&p&&l&&(new Date(l)).valueOf()===(new Date(p.timestamp)).valueOf())S(p.css,t),n(null,null,e,t,{local:!0,remaining:s},f);else try{o[f]=e,(new r.Parser({optimization:r.optimization,paths:[a.path],entryPath:t.entryPath||a.path,mime:t.type,filename:f,rootpath:d,relativeUrls:t.relativeUrls,contents:o,files:u,dumpLineNumbers:r.dumpLineNumbers})).parse(e,function(r,i){if(r)return k(r,f);try{n(r,i,e,t,{local:!1,lastModified:l,remaining:s},f),N(document.getElementById("less-error-message:"+E(f)))}catch(r){k(r,f)}})}catch(c){k(c,f)}},function(e,t){throw new Error("Couldn't load "+t+" ("+e+")")})}function E(e){return e.replace(/^[a-z]+:\/\/?[^\/]+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function S(e,t,n){var r,i=t.href||"",s="less:"+(t.title||E(i));if((r=document.getElementById(s))===null){r=document.createElement("style"),r.type="text/css",t.media&&(r.media=t.media),r.id=s;var o=t&&t.nextSibling||null;(o||document.getElementsByTagName("head")[0]).parentNode.insertBefore(r,o)}if(r.styleSheet)try{r.styleSheet.cssText=e}catch(u){throw new Error("Couldn't reassign styleSheet.cssText.")}else(function(e){r.childNodes.length>0?r.firstChild.nodeValue!==e.nodeValue&&r.replaceChild(e,r.firstChild):r.appendChild(e)})(document.createTextNode(e));if(n&&l){C("saving "+i+" to cache.");try{l.setItem(i,e),l.setItem(i+":timestamp",n)}catch(u){C("failed to save")}}}function x(e,t,n,i){function a(t,n,r){t.status>=200&&t.status<300?n(t.responseText,t.getResponseHeader("Last-Modified")):typeof r=="function"&&r(t.status,e)}var s=T(),u=o?r.fileAsync:r.async;typeof s.overrideMimeType=="function"&&s.overrideMimeType("text/css"),s.open("GET",e,u),s.setRequestHeader("Accept",t||"text/x-less, text/css; q=0.9, */*; q=0.5"),s.send(null),o&&!r.fileAsync?s.status===0||s.status>=200&&s.status<300?n(s.responseText):i(s.status,e):u?s.onreadystatechange=function(){s.readyState==4&&a(s,n,i)}:a(s,n,i)}function T(){if(e.XMLHttpRequest)return new XMLHttpRequest;try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(t){return C("browser doesn't support AJAX."),null}}function N(e){return e&&e.parentNode.removeChild(e)}function C(e){r.env=="development"&&typeof console!="undefined"&&console.log("less: "+e)}function k(e,t){var n="less-error-message:"+E(t),i='
  • {content}
  • ',s=document.createElement("div"),o,u,a=[],f=e.filename||t,l=f.match(/([^\/]+(\?.*)?)$/)[1];s.id=n,s.className="less-error-message",u="

    "+(e.message||"There is an error in your .less file")+"

    "+'

    in '+l+" ";var c=function(e,t,n){e.extract[t]&&a.push(i.replace(/\{line\}/,parseInt(e.line)+(t-1)).replace(/\{class\}/,n).replace(/\{content\}/,e.extract[t]))};e.stack?u+="
    "+e.stack.split("\n").slice(1).join("
    "):e.extract&&(c(e,0,""),c(e,1,"line"),c(e,2,""),u+="on line "+e.line+", column "+(e.column+1)+":

    "+""),s.innerHTML=u,S([".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),s.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),r.env=="development"&&(o=setInterval(function(){document.body&&(document.getElementById(n)?document.body.replaceChild(s,document.getElementById(n)):document.body.insertBefore(s,document.body.firstChild),clearInterval(o))},10))}Array.isArray||(Array.isArray=function(e){return Object.prototype.toString.call(e)==="[object Array]"||e instanceof Array}),Array.prototype.forEach||(Array.prototype.forEach=function(e,t){var n=this.length>>>0;for(var r=0;r>>0,n=new Array(t),r=arguments[1];for(var i=0;i>>0,n=0;if(t===0&&arguments.length===1)throw new TypeError;if(arguments.length>=2)var r=arguments[1];else do{if(n in this){r=this[n++];break}if(++n>=t)throw new TypeError}while(!0);for(;n=t)return-1;n<0&&(n+=t);for(;nh&&(c[u]=c[u].slice(o-h),h=o)}function w(e){var t=e.charCodeAt(0);return t===32||t===10||t===9}function E(e){var t,n,r,i,a;if(e instanceof Function)return e.call(p.parsers);if(typeof e=="string")t=s.charAt(o)===e?e:null,r=1,b();else{b();if(!(t=e.exec(c[u])))return null;r=t[0].length}if(t)return S(r),typeof t=="string"?t:t.length===1?t[0]:t}function S(e){var t=o,n=u,r=o+c[u].length,i=o+=e;while(o=0&&t.charAt(n)!=="\n";n--)r++;return{line:typeof e=="number"?(t.slice(0,e).match(/\n/g)||"").length:null,column:r}}function L(e){return r.mode==="browser"||r.mode==="rhino"?e.filename:n("path").resolve(e.filename)}function A(e,t,n){return{lineNumber:k(e,t).line+1,fileName:L(n)}}function O(e,t){var n=C(e,t),r=k(e.index,n),i=r.line,s=r.column,o=n.split("\n");this.type=e.type||"Syntax",this.message=e.message,this.filename=e.filename||t.filename,this.index=e.index,this.line=typeof i=="number"?i+1:null,this.callLine=e.call&&k(e.call,n).line+1,this.callExtract=o[k(e.call,n).line],this.stack=e.stack,this.column=s,this.extract=[o[i-1],o[i],o[i+1]]}var s,o,u,a,f,l,c,h,p,d=this,t=t||{};t.contents||(t.contents={}),t.rootpath=t.rootpath||"",t.files||(t.files={});var v=function(){},m=this.imports={paths:t.paths||[],queue:[],files:t.files,contents:t.contents,mime:t.mime,error:null,push:function(e,n){var i=this;this.queue.push(e),r.Parser.importer(e,this.paths,function(t,r,s){i.queue.splice(i.queue.indexOf(e),1);var o=s in i.files;i.files[s]=r,t&&!i.error&&(i.error=t),n(t,r,o),i.queue.length===0&&v(i.error)},t)}};return this.env=t=t||{},this.optimization="optimization"in this.env?this.env.optimization:1,this.env.filename=this.env.filename||null,p={imports:m,parse:function(e,a){var f,d,m,g,y,b,w=[],S,x=null;o=u=h=l=0,s=e.replace(/\r\n/g,"\n"),s=s.replace(/^\uFEFF/,""),c=function(e){var n=0,r=/(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,i=/\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,o=/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,u=0,a,f=e[0],l;for(var c=0,h,p;c0?"missing closing `}`":"missing opening `{`",filename:t.filename},t)),e.map(function(e){return e.join("")})}([[]]);if(x)return a(x,t);try{f=new i.Ruleset([],E(this.parsers.primary)),f.root=!0}catch(T){return a(new O(T,t))}f.toCSS=function(e){var s,o,u;return function(s,o){var u=[],a;s=s||{},typeof o=="object"&&!Array.isArray(o)&&(o=Object.keys(o).map(function(e){var t=o[e];return t instanceof i.Value||(t instanceof i.Expression||(t=new i.Expression([t])),t=new i.Value([t])),new i.Rule("@"+e,t,!1,0)}),u=[new i.Ruleset(null,o)]);try{var f=e.call(this,{frames:u}).toCSS([],{compress:s.compress||!1,dumpLineNumbers:t.dumpLineNumbers})}catch(l){throw new O(l,t)}if(a=p.imports.error)throw a instanceof O?a:new O(a,t);return s.yuicompress&&r.mode==="node"?n("ycssmin").cssmin(f):s.compress?f.replace(/(\s)+/g,"$1"):f}}(f.eval);if(o=0&&s.charAt(N)!=="\n";N--)C++;x={type:"Parse",message:"Syntax Error on line "+y,index:o,filename:t.filename,line:y,column:C,extract:[b[y-2],b[y-1],b[y]]}}this.imports.queue.length>0?v=function(e){e=x||e,e?a(e):a(null,f)}:a(x,f)},parsers:{primary:function(){var e,t=[];while((e=E(this.mixin.definition)||E(this.rule)||E(this.ruleset)||E(this.mixin.call)||E(this.comment)||E(this.directive))||E(/^[\s\n]+/)||E(/^;+/))e&&t.push(e);return t},comment:function(){var e;if(s.charAt(o)!=="/")return;if(s.charAt(o+1)==="/")return new i.Comment(E(/^\/\/.*/),!0);if(e=E(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/))return new i.Comment(e)},entities:{quoted:function(){var e,t=o,n;s.charAt(t)==="~"&&(t++,n=!0);if(s.charAt(t)!=='"'&&s.charAt(t)!=="'")return;n&&E("~");if(e=E(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/))return new i.Quoted(e[0],e[1]||e[2],n)},keyword:function(){var e;if(e=E(/^[_A-Za-z-][_A-Za-z0-9-]*/))return i.colors.hasOwnProperty(e)?new i.Color(i.colors[e].slice(1)):new i.Keyword(e)},call:function(){var e,n,r,s,a=o;if(!(e=/^([\w-]+|%|progid:[\w\.]+)\(/.exec(c[u])))return;e=e[1],n=e.toLowerCase();if(n==="url")return null;o+=e.length;if(n==="alpha"){s=E(this.alpha);if(typeof s!="undefined")return s}E("("),r=E(this.entities.arguments);if(!E(")"))return;if(e)return new i.Call(e,r,a,t.filename)},arguments:function(){var e=[],t;while(t=E(this.entities.assignment)||E(this.expression)){e.push(t);if(!E(","))break}return e},literal:function(){return E(this.entities.ratio)||E(this.entities.dimension)||E(this.entities.color)||E(this.entities.quoted)||E(this.entities.unicodeDescriptor)},assignment:function(){var e,t;if((e=E(/^\w+(?=\s?=)/i))&&E("=")&&(t=E(this.entity)))return new i.Assignment(e,t)},url:function(){var e;if(s.charAt(o)!=="u"||!E(/^url\(/))return;return e=E(this.entities.quoted)||E(this.entities.variable)||E(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",x(")"),new i.URL(e.value!=null||e instanceof i.Variable?e:new i.Anonymous(e),t.rootpath)},variable:function(){var e,n=o;if(s.charAt(o)==="@"&&(e=E(/^@@?[\w-]+/)))return new i.Variable(e,n,t.filename)},variableCurly:function(){var e,n,r=o;if(s.charAt(o)==="@"&&(n=E(/^@\{([\w-]+)\}/)))return new i.Variable("@"+n[1],r,t.filename)},color:function(){var e;if(s.charAt(o)==="#"&&(e=E(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/)))return new i.Color(e[1])},dimension:function(){var e,t=s.charCodeAt(o);if(t>57||t<43||t===47||t==44)return;if(e=E(/^([+-]?\d*\.?\d+)(px|%|em|pc|ex|in|deg|s|ms|pt|cm|mm|rad|grad|turn|dpi|dpcm|dppx|rem|vw|vh|vmin|vm|ch)?/))return new i.Dimension(e[1],e[2])},ratio:function(){var e,t=s.charCodeAt(o);if(t>57||t<48)return;if(e=E(/^(\d+\/\d+)/))return new i.Ratio(e[1])},unicodeDescriptor:function(){var e;if(e=E(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new i.UnicodeDescriptor(e[0])},javascript:function(){var e,t=o,n;s.charAt(t)==="~"&&(t++,n=!0);if(s.charAt(t)!=="`")return;n&&E("~");if(e=E(/^`([^`]*)`/))return new i.JavaScript(e[1],o,n)}},variable:function(){var e;if(s.charAt(o)==="@"&&(e=E(/^(@[\w-]+)\s*:/)))return e[1]},shorthand:function(){var e,t;if(!N(/^[@\w.%-]+\/[@\w.-]+/))return;g();if((e=E(this.entity))&&E("/")&&(t=E(this.entity)))return new i.Shorthand(e,t);y()},mixin:{call:function(){var e=[],n,r,u=[],a=[],f,l,c,h,p,d,v,m=o,b=s.charAt(o),w,S,C=!1;if(b!=="."&&b!=="#")return;g();while(n=E(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/))e.push(new i.Element(r,n,o)),r=E(">");if(E("(")){p=[];while(c=E(this.expression)){h=null,S=c;if(c.value.length==1){var k=c.value[0];k instanceof i.Variable&&E(":")&&(p.length>0&&(d&&T("Cannot mix ; and , as delimiter types"),v=!0),S=x(this.expression),h=w=k.name)}p.push(S),a.push({name:h,value:S});if(E(","))continue;if(E(";")||d)v&&T("Cannot mix ; and , as delimiter types"),d=!0,p.length>1&&(S=new i.Value(p)),u.push({name:w,value:S}),w=null,p=[],v=!1}x(")")}f=d?u:a,E(this.important)&&(C=!0);if(e.length>0&&(E(";")||N("}")))return new i.mixin.Call(e,f,m,t.filename,C);y()},definition:function(){var e,t=[],n,r,u,a,f,c=!1;if(s.charAt(o)!=="."&&s.charAt(o)!=="#"||N(/^[^{]*\}/))return;g();if(n=E(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){e=n[1];do{E(this.comment);if(s.charAt(o)==="."&&E(/^\.{3}/)){c=!0,t.push({variadic:!0});break}if(!(u=E(this.entities.variable)||E(this.entities.literal)||E(this.entities.keyword)))break;if(u instanceof i.Variable)if(E(":"))a=x(this.expression,"expected expression"),t.push({name:u.name,value:a});else{if(E(/^\.{3}/)){t.push({name:u.name,variadic:!0}),c=!0;break}t.push({name:u.name})}else t.push({value:u})}while(E(",")||E(";"));E(")")||(l=o,y()),E(this.comment),E(/^when/)&&(f=x(this.conditions,"expected condition")),r=E(this.block);if(r)return new i.mixin.Definition(e,t,r,f,c);y()}}},entity:function(){return E(this.entities.literal)||E(this.entities.variable)||E(this.entities.url)||E(this.entities.call)||E(this.entities.keyword)||E(this.entities.javascript)||E(this.comment)},end:function(){return E(";")||N("}")},alpha:function(){var e;if(!E(/^\(opacity=/i))return;if(e=E(/^\d+/)||E(this.entities.variable))return x(")"),new i.Alpha(e)},element:function(){var e,t,n,r;n=E(this.combinator),e=E(/^(?:\d+\.\d+|\d+)%/)||E(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||E("*")||E("&")||E(this.attribute)||E(/^\([^()@]+\)/)||E(/^[\.#](?=@)/)||E(this.entities.variableCurly),e||E("(")&&(r=E(this.entities.variableCurly)||E(this.entities.variable)||E(this.selector))&&E(")")&&(e=new i.Paren(r));if(e)return new i.Element(n,e,o)},combinator:function(){var e,t=s.charAt(o);if(t===">"||t==="+"||t==="~"||t==="|"){o++;while(s.charAt(o).match(/\s/))o++;return new i.Combinator(t)}return s.charAt(o-1).match(/\s/)?new i.Combinator(" "):new i.Combinator(null)},selector:function(){var e,t,n=[],r,u;if(E("("))return e=E(this.entity),E(")")?new i.Selector([new i.Element("",e,o)]):null;while(t=E(this.element)){r=s.charAt(o),n.push(t);if(r==="{"||r==="}"||r===";"||r===","||r===")")break}if(n.length>0)return new i.Selector(n)},attribute:function(){var e="",t,n,r;if(!E("["))return;if(t=E(/^(?:[_A-Za-z0-9-]|\\.)+/)||E(this.entities.quoted))(r=E(/^[|~*$^]?=/))&&(n=E(this.entities.quoted)||E(/^[\w-]+/))?e=[t,r,n.toCSS?n.toCSS():n].join(""):e=t;if(!E("]"))return;if(e)return"["+e+"]"},block:function(){var e;if(E("{")&&(e=E(this.primary))&&E("}"))return e},ruleset:function(){var e=[],n,r,u,a;g(),t.dumpLineNumbers&&(a=A(o,s,t));while(n=E(this.selector)){e.push(n),E(this.comment);if(!E(","))break;E(this.comment)}if(e.length>0&&(r=E(this.block))){var f=new i.Ruleset(e,r,t.strictImports);return t.dumpLineNumbers&&(f.debugInfo=a),f}l=o,y()},rule:function(){var e,t,n=s.charAt(o),r,a;g();if(n==="."||n==="#"||n==="&")return;if(e=E(this.variable)||E(this.property)){e.charAt(0)!="@"&&(a=/^([^@+\/'"*`(;{}-]*);/.exec(c[u]))?(o+=a[0].length-1,t=new i.Anonymous(a[1])):e==="font"?t=E(this.font):t=E(this.value),r=E(this.important);if(t&&E(this.end))return new i.Rule(e,t,r,f);l=o,y()}},"import":function(){var e,n,r=o;g();var s=E(/^@import(?:-(once))?\s+/);if(s&&(e=E(this.entities.quoted)||E(this.entities.url))){n=E(this.mediaFeatures);if(E(";"))return new i.Import(e,m,n,s[1]==="once",r,t.rootpath)}y()},mediaFeature:function(){var e,t,n=[];do if(e=E(this.entities.keyword))n.push(e);else if(E("(")){t=E(this.property),e=E(this.entity);if(!E(")"))return null;if(t&&e)n.push(new i.Paren(new i.Rule(t,e,null,o,!0)));else{if(!e)return null;n.push(new i.Paren(e))}}while(e);if(n.length>0)return new i.Expression(n)},mediaFeatures:function(){var e,t=[];do if(e=E(this.mediaFeature)){t.push(e);if(!E(","))break}else if(e=E(this.entities.variable)){t.push(e);if(!E(","))break}while(e);return t.length>0?t:null},media:function(){var e,n,r,u;t.dumpLineNumbers&&(u=A(o,s,t));if(E(/^@media/)){e=E(this.mediaFeatures);if(n=E(this.block))return r=new i.Media(n,e),t.dumpLineNumbers&&(r.debugInfo=u),r}},directive:function(){var e,n,r,u,a,f,l,c,h,p;if(s.charAt(o)!=="@")return;if(n=E(this["import"])||E(this.media))return n;g(),e=E(/^@[a-z-]+/);if(!e)return;l=e,e.charAt(1)=="-"&&e.indexOf("-",2)>0&&(l="@"+e.slice(e.indexOf("-",2)+1));switch(l){case"@font-face":c=!0;break;case"@viewport":case"@top-left":case"@top-left-corner":case"@top-center":case"@top-right":case"@top-right-corner":case"@bottom-left":case"@bottom-left-corner":case"@bottom-center":case"@bottom-right":case"@bottom-right-corner":case"@left-top":case"@left-middle":case"@left-bottom":case"@right-top":case"@right-middle":case"@right-bottom":c=!0;break;case"@page":case"@document":case"@supports":case"@keyframes":c=!0,h=!0;break;case"@namespace":p=!0}h&&(e+=" "+(E(/^[^{]+/)||"").trim());if(c){if(r=E(this.block))return new i.Directive(e,r)}else if((n=p?E(this.expression):E(this.entity))&&E(";")){var d=new i.Directive(e,n);return t.dumpLineNumbers&&(d.debugInfo=A(o,s,t)),d}y()},font:function(){var e=[],t=[],n,r,s,o;while(o=E(this.shorthand)||E(this.entity))t.push(o);e.push(new i.Expression(t));if(E(","))while(o=E(this.expression)){e.push(o);if(!E(","))break}return new i.Value(e)},value:function(){var e,t=[],n;while(e=E(this.expression)){t.push(e);if(!E(","))break}if(t.length>0)return new i.Value(t)},important:function(){if(s.charAt(o)==="!")return E(/^! *important/)},sub:function(){var e;if(E("(")&&(e=E(this.expression))&&E(")"))return e},multiplication:function(){var e,t,n,r;if(e=E(this.operand)){while(!N(/^\/[*\/]/)&&(n=E("/")||E("*"))&&(t=E(this.operand)))r=new i.Operation(n,[r||e,t]);return r||e}},addition:function(){var e,t,n,r;if(e=E(this.multiplication)){while((n=E(/^[-+]\s+/)||!w(s.charAt(o-1))&&(E("+")||E("-")))&&(t=E(this.multiplication)))r=new i.Operation(n,[r||e,t]);return r||e}},conditions:function(){var e,t,n=o,r;if(e=E(this.condition)){while(E(",")&&(t=E(this.condition)))r=new i.Condition("or",r||e,t,n);return r||e}},condition:function(){var e,t,n,r,s=o,u=!1;E(/^not/)&&(u=!0),x("(");if(e=E(this.addition)||E(this.entities.keyword)||E(this.entities.quoted))return(r=E(/^(?:>=|=<|[<=>])/))?(t=E(this.addition)||E(this.entities.keyword)||E(this.entities.quoted))?n=new i.Condition(r,e,t,s,u):T("expected expression"):n=new i.Condition("=",e,new i.Keyword("true"),s,u),x(")"),E(/^and/)?new i.Condition("and",n,E(this.condition)):n},operand:function(){var e,t=s.charAt(o+1);s.charAt(o)==="-"&&(t==="@"||t==="(")&&(e=E("-"));var n=E(this.sub)||E(this.entities.dimension)||E(this.entities.color)||E(this.entities.variable)||E(this.entities.call);return e?new i.Operation("*",[new i.Dimension(-1),n]):n},expression:function(){var e,t,n=[],r;while(e=E(this.addition)||E(this.entity))n.push(e);if(n.length>0)return new i.Expression(n)},property:function(){var e;if(e=E(/^(\*?-?[_a-z0-9-]+)\s*:/))return e[1]}}}};if(r.mode==="browser"||r.mode==="rhino")r.Parser.importer=function(e,t,n,r){!/^([a-z-]+:)?\//.test(e)&&t.length>0&&(e=t[0]+e),w({href:e,title:e,type:r.mime,contents:r.contents,files:r.files,rootpath:r.rootpath,entryPath:r.entryPath,relativeUrls:r.relativeUrls},function(e,i,s,o,u,a){e&&typeof r.errback=="function"?r.errback.call(null,a,t,n,r):n.call(null,e,i,a)},!0)};(function(e){function t(t){return e.functions.hsla(t.h,t.s,t.l,t.a)}function n(t,n){return t instanceof e.Dimension&&t.unit=="%"?parseFloat(t.value*n/100):r(t)}function r(t){if(t instanceof e.Dimension)return parseFloat(t.unit=="%"?t.value/100:t.value);if(typeof t=="number")return t;throw{error:"RuntimeError",message:"color functions take numbers as parameters"}}function i(e){return Math.min(1,Math.max(0,e))}e.functions={rgb:function(e,t,n){return this.rgba(e,t,n,1)},rgba:function(t,i,s,o){var u=[t,i,s].map(function(e){return n(e,256)});return o=r(o),new e.Color(u,o)},hsl:function(e,t,n){return this.hsla(e,t,n,1)},hsla:function(e,t,n,i){function u(e){return e=e<0?e+1:e>1?e-1:e,e*6<1?o+(s-o)*e*6:e*2<1?s:e*3<2?o+(s-o)*(2/3-e)*6:o}e=r(e)%360/360,t=r(t),n=r(n),i=r(i);var s=n<=.5?n*(t+1):n+t-n*t,o=n*2-s;return this.rgba(u(e+1/3)*255,u(e)*255,u(e-1/3)*255,i)},hsv:function(e,t,n){return this.hsva(e,t,n,1)},hsva:function(e,t,n,i){e=r(e)%360/360*360,t=r(t),n=r(n),i=r(i);var s,o;s=Math.floor(e/60%6),o=e/60-s;var u=[n,n*(1-t),n*(1-o*t),n*(1-(1-o)*t)],a=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return this.rgba(u[a[s][0]]*255,u[a[s][1]]*255,u[a[s][2]]*255,i)},hue:function(t){return new e.Dimension(Math.round(t.toHSL().h))},saturation:function(t){return new e.Dimension(Math.round(t.toHSL().s*100),"%")},lightness:function(t){return new e.Dimension(Math.round(t.toHSL().l*100),"%")},red:function(t){return new e.Dimension(t.rgb[0])},green:function(t){return new e.Dimension(t.rgb[1])},blue:function(t){return new e.Dimension(t.rgb[2])},alpha:function(t){return new e.Dimension(t.toHSL().a)},luma:function(t){return new e.Dimension(Math.round((.2126*(t.rgb[0]/255)+.7152*(t.rgb[1]/255)+.0722*(t.rgb[2]/255))*t.alpha*100),"%")},saturate:function(e,n){var r=e.toHSL();return r.s+=n.value/100,r.s=i(r.s),t(r)},desaturate:function(e,n){var r=e.toHSL();return r.s-=n.value/100,r.s=i(r.s),t(r)},lighten:function(e,n){var r=e.toHSL();return r.l+=n.value/100,r.l=i(r.l),t(r)},darken:function(e,n){var r=e.toHSL();return r.l-=n.value/100,r.l=i(r.l),t(r)},fadein:function(e,n){var r=e.toHSL();return r.a+=n.value/100,r.a=i(r.a),t(r)},fadeout:function(e,n){var r=e.toHSL();return r.a-=n.value/100,r.a=i(r.a),t(r)},fade:function(e,n){var r=e.toHSL();return r.a=n.value/100,r.a=i(r.a),t(r)},spin:function(e,n){var r=e.toHSL(),i=(r.h+n.value)%360;return r.h=i<0?360+i:i,t(r)},mix:function(t,n,r){r||(r=new e.Dimension(50));var i=r.value/100,s=i*2-1,o=t.toHSL().a-n.toHSL().a,u=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,a=1-u,f=[t.rgb[0]*u+n.rgb[0]*a,t.rgb[1]*u+n.rgb[1]*a,t.rgb[2]*u+n.rgb[2]*a],l=t.alpha*i+n.alpha*(1-i);return new e.Color(f,l)},greyscale:function(t){return this.desaturate(t,new e.Dimension(100))},contrast:function(e,t,n,r){return e.rgb?(typeof n=="undefined"&&(n=this.rgba(255,255,255,1)),typeof t=="undefined"&&(t=this.rgba(0,0,0,1)),typeof r=="undefined"?r=.43:r=r.value,(.2126*(e.rgb[0]/255)+.7152*(e.rgb[1]/255)+.0722*(e.rgb[2]/255))*e.alpha255?255:e<0?0:e).toString(16),e.length===1?"0"+e:e}).join("")},operate:function(t,n){var r=[];n instanceof e.Color||(n=n.toColor());for(var i=0;i<3;i++)r[i]=e.operate(t,this.rgb[i],n.rgb[i]);return new e.Color(r,this.alpha+n.alpha)},toHSL:function(){var e=this.rgb[0]/255,t=this.rgb[1]/255,n=this.rgb[2]/255,r=this.alpha,i=Math.max(e,t,n),s=Math.min(e,t,n),o,u,a=(i+s)/2,f=i-s;if(i===s)o=u=0;else{u=a>.5?f/(2-i-s):f/(i+s);switch(i){case e:o=(t-n)/f+(t255?255:e<0?0:e).toString(16),e.length===1?"0"+e:e}).join("")},compare:function(e){return e.rgb?e.rgb[0]===this.rgb[0]&&e.rgb[1]===this.rgb[1]&&e.rgb[2]===this.rgb[2]&&e.alpha===this.alpha?0:-1:-1}}}(n("../tree")),function(e){e.Comment=function(e,t){this.value=e,this.silent=!!t},e.Comment.prototype={toCSS:function(e){return e.compress?"":this.value},eval:function(){return this}}}(n("../tree")),function(e){e.Condition=function(e,t,n,r,i){this.op=e.trim(),this.lvalue=t,this.rvalue=n,this.index=r,this.negate=i},e.Condition.prototype.eval=function(e){var t=this.lvalue.eval(e),n=this.rvalue.eval(e),r=this.index,i,i=function(e){switch(e){case"and":return t&&n;case"or":return t||n;default:if(t.compare)i=t.compare(n);else{if(!n.compare)throw{type:"Type",message:"Unable to perform comparison",index:r};i=n.compare(t)}switch(i){case-1:return e==="<"||e==="=<";case 0:return e==="="||e===">="||e==="=<";case 1:return e===">"||e===">="}}}(this.op);return this.negate?!i:i}}(n("../tree")),function(e){e.Dimension=function(e,t){this.value=parseFloat(e),this.unit=t||null},e.Dimension.prototype={eval:function(){return this},toColor:function(){return new e.Color([this.value,this.value,this.value])},toCSS:function(){var e=this.value+this.unit;return e},operate:function(t,n){return new e.Dimension(e.operate(t,this.value,n.value),this.unit||n.unit)},compare:function(t){return t instanceof e.Dimension?t.value>this.value?-1:t.value":e.compress?">":" > ","|":e.compress?"|":" | "}[this.value]}}(n("../tree")),function(e){e.Expression=function(e){this.value=e},e.Expression.prototype={eval:function(t){return this.value.length>1?new e.Expression(this.value.map(function(e){return e.eval(t)})):this.value.length===1?this.value[0].eval(t):this},toCSS:function(e){return this.value.map(function(t){return t.toCSS?t.toCSS(e):""}).join(" ")}}}(n("../tree")),function(e){e.Import=function(t,n,r,i,s,o){var u=this;this.once=i,this.index=s,this._path=t,this.features=r&&new e.Value(r),this.rootpath=o,t instanceof e.Quoted?this.path=/(\.[a-z]*$)|([\?;].*)$/.test(t.value)?t.value:t.value+".less":this.path=t.value.value||t.value,this.css=/css([\?;].*)?$/.test(this.path),this.css||n.push(this.path,function(t,n,r){t&&(t.index=s),r&&u.once&&(u.skip=r),u.root=n||new e.Ruleset([],[])})},e.Import.prototype={toCSS:function(e){var t=this.features?" "+this.features.toCSS(e):"";return this.css?(typeof this._path.value=="string"&&!/^(?:[a-z-]+:|\/)/.test(this._path.value)&&(this._path.value=this.rootpath+this._path.value),"@import "+this._path.toCSS()+t+";\n"):""},eval:function(t){var n,r=this.features&&this.features.eval(t);return this.skip?[]:this.css?this:(n=new e.Ruleset([],this.root.rules.slice(0)),n.evalImports(t),this.features?new e.Media(n.rules,this.features.value):n.rules)}}}(n("../tree")),function(e){e.JavaScript=function(e,t,n){this.escaped=n,this.expression=e,this.index=t},e.JavaScript.prototype={eval:function(t){var n,r=this,i={},s=this.expression.replace(/@\{([\w-]+)\}/g,function(n,i){return e.jsify((new e.Variable("@"+i,r.index)).eval(t))});try{s=new Function("return ("+s+")")}catch(o){throw{message:"JavaScript evaluation error: `"+s+"`",index:this.index}}for(var u in t.frames[0].variables())i[u.slice(1)]={value:t.frames[0].variables()[u].value,toJS:function(){return this.value.eval(t).toCSS()}};try{n=s.call(i)}catch(o){throw{message:"JavaScript evaluation error: '"+o.name+": "+o.message+"'",index:this.index}}return typeof n=="string"?new e.Quoted('"'+n+'"',n,this.escaped,this.index):Array.isArray(n)?new e.Anonymous(n.join(", ")):new e.Anonymous(n)}}}(n("../tree")),function(e){e.Keyword=function(e){this.value=e},e.Keyword.prototype={eval:function(){return this},toCSS:function(){return this.value},compare:function(t){return t instanceof e.Keyword?t.value===this.value?0:1:-1}},e.True=new e.Keyword("true"),e.False=new e.Keyword("false")}(n("../tree")),function(e){e.Media=function(t,n){var r=this.emptySelectors();this.features=new e.Value(n),this.ruleset=new e.Ruleset(r,t),this.ruleset.allowImports=!0},e.Media.prototype={toCSS:function(e,t){var n=this.features.toCSS(t);return this.ruleset.root=e.length===0||e[0].multiMedia,"@media "+n+(t.compress?"{":" {\n ")+this.ruleset.toCSS(e,t).trim().replace(/\n/g,"\n ")+(t.compress?"}":"\n}\n")},eval:function(t){t.mediaBlocks||(t.mediaBlocks=[],t.mediaPath=[]);var n=new e.Media([],[]);return this.debugInfo&&(this.ruleset.debugInfo=this.debugInfo,n.debugInfo=this.debugInfo),n.features=this.features.eval(t),t.mediaPath.push(n),t.mediaBlocks.push(n),t.frames.unshift(this.ruleset),n.ruleset=this.ruleset.eval(t),t.frames.shift(),t.mediaPath.pop(),t.mediaPath.length===0?n.evalTop(t):n.evalNested(t)},variable:function(t){return e.Ruleset.prototype.variable.call(this.ruleset,t)},find:function(){return e.Ruleset.prototype.find.apply(this.ruleset,arguments)},rulesets:function(){return e.Ruleset.prototype.rulesets.apply(this.ruleset)},emptySelectors:function(){var t=new e.Element("","&",0);return[new e.Selector([t])]},evalTop:function(t){var n=this;if(t.mediaBlocks.length>1){var r=this.emptySelectors();n=new e.Ruleset(r,t.mediaBlocks),n.multiMedia=!0}return delete t.mediaBlocks,delete t.mediaPath,n},evalNested:function(t){var n,r,i=t.mediaPath.concat([this]);for(n=0;n0;n--)t.splice(n,0,new e.Anonymous("and"));return new e.Expression(t)})),new e.Ruleset([],[])},permute:function(e){if(e.length===0)return[];if(e.length===1)return e[0];var t=[],n=this.permute(e.slice(1));for(var r=0;r0){c=!0;for(a=0;athis.params.length)return!1;if(this.required>0&&n>this.params.length)return!1}r=Math.min(n,this.arity);for(var s=0;si.selectors[o].elements.length?Array.prototype.push.apply(r,i.find(new e.Selector(t.elements.slice(1)),n)):r.push(i);break}}),this._lookups[o]=r)},toCSS:function(t,n){var r=[],i=[],s=[],o=[],u=[],a,f,l;this.root||this.joinSelectors(u,t,this.selectors);for(var c=0;c0){f=e.debugInfo(n,this),a=u.map(function(e){return e.map(function(e){return e.toCSS(n)}).join("").trim()}).join(n.compress?",":",\n");for(var c=i.length-1;c>=0;c--)s.indexOf(i[c])===-1&&s.unshift(i[c]);i=s,r.push(f+a+(n.compress?"{":" {\n ")+i.join(n.compress?"":"\n ")+(n.compress?"}":"\n}\n"))}return r.push(o),r.join("")+(n.compress?"\n":"")},joinSelectors:function(e,t,n){for(var r=0;r0)for(i=0;i0&&this.mergeElementsOnToSelectors(g,a);for(s=0;s0&&(l[0].elements=l[0].elements.slice(0),l[0].elements.push(new e.Element(f.combinator,"",0))),y.push(l);else for(o=0;o0?(h=l.slice(0),m=h.pop(),d=new e.Selector(m.elements.slice(0)),v=!1):d=new e.Selector([]),c.length>1&&(p=p.concat(c.slice(1))),c.length>0&&(v=!1,d.elements.push(new e.Element(f.combinator,c[0].elements[0].value,0)),d.elements=d.elements.concat(c[0].elements.slice(1))),v||h.push(d),h=h.concat(p),y.push(h)}a=y,g=[]}}g.length>0&&this.mergeElementsOnToSelectors(g,a);for(i=0;i0?i[i.length-1]=new e.Selector(i[i.length-1].elements.concat(t)):i.push(new e.Selector(t))}}}(n("../tree")),function(e){e.Selector=function(e){this.elements=e},e.Selector.prototype.match=function(e){var t=this.elements,n=t.length,r,i,s,o;r=e.elements.slice(e.elements.length&&e.elements[0].value==="&"?1:0),i=r.length,s=Math.min(n,i);if(i===0||n1?"["+e.value.map(function(e){return e.toCSS(!1)}).join(", ")+"]":e.toCSS(!1)}}(n("./tree"));var o=/^(file|chrome(-extension)?|resource|qrc|app):/.test(location.protocol);r.env=r.env||(location.hostname=="127.0.0.1"||location.hostname=="0.0.0.0"||location.hostname=="localhost"||location.port.length>0||o?"development":"production"),r.async=r.async||!1,r.fileAsync=r.fileAsync||!1,r.poll=r.poll||(o?1e3:1500);if(r.functions)for(var u in r.functions)r.tree.functions[u]=r.functions[u];var a=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(location.hash);a&&(r.dumpLineNumbers=a[1]),r.watch=function(){return r.watchMode||(r.env="development",f()),this.watchMode=!0},r.unwatch=function(){return clearInterval(r.watchTimer),this.watchMode=!1},/!watch/.test(location.hash)&&r.watch();var l=null;if(r.env!="development")try{l=typeof e.localStorage=="undefined"?null:e.localStorage}catch(c){}var h=document.getElementsByTagName("link"),p=/^text\/(x-)?less$/;r.sheets=[];for(var d=0;d -{% endoro_css %} - -{% if hasLess %} - - - -{% endif %} diff --git a/src/Oro/Bundle/AsseticBundle/Tests/Unit/DependencyInjection/ConfigurationTest.php b/src/Oro/Bundle/AsseticBundle/Tests/Unit/DependencyInjection/ConfigurationTest.php deleted file mode 100644 index fae0b4b36af5..000000000000 --- a/src/Oro/Bundle/AsseticBundle/Tests/Unit/DependencyInjection/ConfigurationTest.php +++ /dev/null @@ -1,19 +0,0 @@ -getConfigTreeBuilder(); - - $this->assertInstanceOf('Symfony\Component\Config\Definition\Builder\TreeBuilder', $builder); - - $rootNode = $builder->buildTree(); - $this->assertInstanceOf('Symfony\Component\Config\Definition\ArrayNode', $rootNode); - $this->assertEquals('oro_assetic', $rootNode->getName()); - } -} diff --git a/src/Oro/Bundle/AsseticBundle/Tests/Unit/DependencyInjection/OroAsseticExtensionTest.php b/src/Oro/Bundle/AsseticBundle/Tests/Unit/DependencyInjection/OroAsseticExtensionTest.php deleted file mode 100644 index 938e59d781ac..000000000000 --- a/src/Oro/Bundle/AsseticBundle/Tests/Unit/DependencyInjection/OroAsseticExtensionTest.php +++ /dev/null @@ -1,50 +0,0 @@ - [], 'css_debug_all' => true], - ['compress' => [[]], 'uncompress' => [['first.css', 'second.css']]], - ], - [ - ['css_debug' => [], 'css_debug_all' => false], - ['compress' => [['first.css', 'second.css']], 'uncompress' => [[]]], - ], - ]; - } - - /** - * @dataProvider getAssetsDataProvider - */ - public function testGetAssets($config, $expectedCss) - { - $extension = new OroAsseticExtension(); - - $container = $this->createMock('Symfony\Component\DependencyInjection\ContainerBuilder'); - - $container->expects($this->once()) - ->method('getParameter') - ->will( - $this->returnValue( - [ - TestBundle::class - ] - ) - ); - - $assets = $extension->getAssets($container, $config); - $this->assertEquals($expectedCss, $assets['css']); - } -} diff --git a/src/Oro/Bundle/AsseticBundle/Tests/Unit/Factory/OroAssetManagerTest.php b/src/Oro/Bundle/AsseticBundle/Tests/Unit/Factory/OroAssetManagerTest.php deleted file mode 100644 index 3fdc79a7afb8..000000000000 --- a/src/Oro/Bundle/AsseticBundle/Tests/Unit/Factory/OroAssetManagerTest.php +++ /dev/null @@ -1,165 +0,0 @@ -am = $this->getMockBuilder('Assetic\Factory\LazyAssetManager') - ->disableOriginalConstructor() - ->getMock(); - - $this->twig = $this->getMockBuilder('\Twig_Environment') - ->disableOriginalConstructor() - ->getMock(); - - $this->manager = new OroAssetManager($this->am, $this->twig, ['assetGroups'], ['compiledGroup']); - } - - public function testGetGroups() - { - $data = $this->manager->getAssetGroups(); - $this->assertEquals('assetGroups', $data[0]); - } - - public function testCompiledGroups() - { - $data = $this->manager->getCompiledGroups(); - $this->assertEquals('compiledGroup', $data[0]); - } - - public function testGetAssets() - { - $resource = $this->createMockResource('resource_name', 'resource_content'); - $token = $this->getMockBuilder('Twig_TokenStream')->disableOriginalConstructor()->getMock(); - - $barAsset = $this->createMockOroAsseticNode('uncompress_bar_asset'); - $fooAsset = $this->createMockOroAsseticNode('uncompress_foo_asset', [$barAsset]); - - $this->am->expects($this->once()) - ->method('getResources') - ->will($this->returnValue([$resource])); - - $this->twig->expects($this->once()) - ->method('tokenize') - ->with('resource_content', 'resource_name') - ->will($this->returnValue($token)); - - $this->twig->expects($this->once()) - ->method('parse') - ->with($token) - ->will($this->returnValue($fooAsset)); - - $this->assertEquals( - [ - 'uncompress_foo_asset' => $fooAsset, - 'uncompress_bar_asset' => $barAsset, - ], - $this->manager->getAssets() - ); - } - - public function testGet() - { - $resource = $this->createMockResource('resource_name', 'resource_content'); - $token = $this->getMockBuilder('Twig_TokenStream')->disableOriginalConstructor()->getMock(); - $asset = $this->createMockOroAsseticNode('uncompress_test_asset'); - - $assetFile = new FileAsset('test.css'); - $asset->expects($this->once())->method('getUnCompressAsset')->will($this->returnValue($assetFile)); - - $this->am->expects($this->once()) - ->method('getResources') - ->will($this->returnValue([$resource])); - - $this->twig->expects($this->once()) - ->method('tokenize') - ->with('resource_content', 'resource_name') - ->will($this->returnValue($token)); - - $this->twig->expects($this->once()) - ->method('parse') - ->with($token) - ->will($this->returnValue($asset)); - - $this->assertEquals( - $assetFile, - $this->manager->get('uncompress_test_asset') - ); - } - - public function testHas() - { - $resource = $this->createMockResource('resource_name', 'resource_content'); - $token = $this->getMockBuilder('Twig_TokenStream')->disableOriginalConstructor()->getMock(); - $asset = $this->createMockOroAsseticNode('uncompress_test_asset'); - - $this->am->expects($this->once()) - ->method('getResources') - ->will($this->returnValue([$resource])); - - $this->twig->expects($this->once()) - ->method('tokenize') - ->with('resource_content', 'resource_name') - ->will($this->returnValue($token)); - - $this->twig->expects($this->once()) - ->method('parse') - ->with($token) - ->will($this->returnValue($asset)); - - $this->assertTrue($this->manager->has('uncompress_test_asset')); - } - - protected function createMockResource($name, $content) - { - $result = $this->createMock('Assetic\Factory\Resource\ResourceInterface'); - - $result->expects($this->once()) - ->method('getContent') - ->will($this->returnValue($content)); - - $result->expects($this->once()) - ->method('__toString') - ->will($this->returnValue($name)); - - return $result; - } - - protected function createMockOroAsseticNode($nameUnCompress, array $children = []) - { - $result = $this->getMockBuilder(OroAsseticNode::class) - ->disableOriginalConstructor() - ->setMethods(['getNameUnCompress', 'getUnCompressAsset', 'getAttribute', 'getIterator']) - ->getMock(); - - $result->expects($this->any()) - ->method('getIterator') - ->will($this->returnValue(new \ArrayIterator($children))); - - $result->expects($this->once()) - ->method('getNameUnCompress') - ->will($this->returnValue($nameUnCompress)); - - return $result; - } -} diff --git a/src/Oro/Bundle/AsseticBundle/Tests/Unit/Fixtures/Resources/config/assets.yml b/src/Oro/Bundle/AsseticBundle/Tests/Unit/Fixtures/Resources/config/assets.yml deleted file mode 100644 index 227322cdd3eb..000000000000 --- a/src/Oro/Bundle/AsseticBundle/Tests/Unit/Fixtures/Resources/config/assets.yml +++ /dev/null @@ -1,5 +0,0 @@ -css: - 'css_group': - - 'first.css' - - 'second.css' - diff --git a/src/Oro/Bundle/AsseticBundle/Tests/Unit/Fixtures/TestBundle.php b/src/Oro/Bundle/AsseticBundle/Tests/Unit/Fixtures/TestBundle.php deleted file mode 100644 index 2cc0bae3142e..000000000000 --- a/src/Oro/Bundle/AsseticBundle/Tests/Unit/Fixtures/TestBundle.php +++ /dev/null @@ -1,7 +0,0 @@ -compressAsset = new AssetCollection([$asset]); - $this->unCompressAsset = new AssetCollection([$asset]); - $this->node = new OroAsseticNode( - [ - 'compress' => $this->compressAsset, - 'un_compress' => $this->unCompressAsset - ], - [ - 'un_compress' => 'uncompress_test_asset', - 'compress' => 'compress_test_asset' - ], - [], - ['uncompress' => [['compile1.css', 'compile2.css']]], - new \Twig_Node(), - [], - 10, - 'oro_css' - ); - } - - public function testGetUnCompressAsset() - { - $this->assertEquals($this->unCompressAsset, $this->node->getUnCompressAsset()); - } - - public function testGetCompressAsset() - { - $this->assertEquals($this->compressAsset, $this->node->getCompressAsset()); - } - - public function testGetNameUnCompress() - { - $this->assertEquals('uncompress_test_asset', $this->node->getNameUnCompress()); - } - - public function testCompile() - { - $compiler = $this->assetsFactory = $this->getMockBuilder('\Twig_Compiler') - ->disableOriginalConstructor() - ->getMock(); - - $compiler->expects($this->any()) - ->method('write') - ->will($this->returnValue($compiler)); - - $compiler->expects($this->any()) - ->method('repr') - ->will($this->returnValue($compiler)); - - $compiler->expects($this->any()) - ->method('raw') - ->will($this->returnValue($compiler)); - - $this->node->compile($compiler); - } -} diff --git a/src/Oro/Bundle/AsseticBundle/Tests/Unit/Parser/AsseticTokenParserTest.php b/src/Oro/Bundle/AsseticBundle/Tests/Unit/Parser/AsseticTokenParserTest.php deleted file mode 100644 index 2fd4188665fa..000000000000 --- a/src/Oro/Bundle/AsseticBundle/Tests/Unit/Parser/AsseticTokenParserTest.php +++ /dev/null @@ -1,144 +0,0 @@ -assetsFactory = $this->getMockBuilder('Symfony\Bundle\AsseticBundle\Factory\AssetFactory') - ->disableOriginalConstructor() - ->getMock(); - - $this->assets = [ - 'compress' => [ - [ - 'first.css', - 'second.css' - ] - ], - 'uncompress' => [ - [ - 'third.css', - 'fourth.css' - ] - ] - ]; - - $this->tagName = 'oro_css'; - - $this->parser = new AsseticTokenParser($this->assets, $this->assetsFactory, $this->tagName, 'css/*.css'); - } - - public function testGetTag() - { - $this->assertEquals($this->tagName, $this->parser->getTag()); - } - - public function testTestEndTag() - { - $token = new Twig_Token(Twig_Token::NAME_TYPE, 'end' . $this->tagName, 31); - $this->assertTrue($this->parser->testEndTag($token)); - } - - public function testParse() - { - $parser = $this->getMockBuilder('Twig_Parser') - ->disableOriginalConstructor() - ->getMock(); - - $startToken = new Twig_Token(Twig_Token::NAME_TYPE, 'oro_css', 31); - - $stream = new Twig_TokenStream( - [ - new Twig_Token(Twig_Token::NAME_TYPE, 'filter', 31), - new Twig_Token(Twig_Token::OPERATOR_TYPE, '=', 31), - new Twig_Token(Twig_Token::STRING_TYPE, 'cssrewrite, lessphp, ?yui_css', 31), - new Twig_Token(Twig_Token::NAME_TYPE, 'debug', 31), - new Twig_Token(Twig_Token::OPERATOR_TYPE, '=', 31), - new Twig_Token(Twig_Token::NAME_TYPE, 'false', 31), - new Twig_Token(Twig_Token::NAME_TYPE, 'combine', 31), - new Twig_Token(Twig_Token::OPERATOR_TYPE, '=', 31), - new Twig_Token(Twig_Token::NAME_TYPE, 'false', 31), - new Twig_Token(Twig_Token::NAME_TYPE, 'output', 31), - new Twig_Token(Twig_Token::OPERATOR_TYPE, '=', 31), - new Twig_Token(Twig_Token::STRING_TYPE, 'css/oro_app.css', 31), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 31), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 32), - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 33), - new Twig_Token(Twig_Token::NAME_TYPE, 'endoro_css', 33), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 33), - new Twig_Token(Twig_Token::EOF_TYPE, '', 31), - ] - ); - - $bodyNode = $this->getMockBuilder('\Twig_Node') - ->disableOriginalConstructor() - ->getMock(); - - $parser->expects($this->once()) - ->method('subparse') - ->will($this->returnValue($bodyNode)); - - $parser->expects($this->once()) - ->method('getStream') - ->will($this->returnValue($stream)); - - $this->parser->setParser($parser); - - $assert = $this->getMockBuilder('Assetic\Asset\AssetCollection') - ->disableOriginalConstructor() - ->getMock(); - - $this->assetsFactory->expects($this->atLeastOnce()) - ->method('createAsset') - ->will($this->returnValue($assert)); - /** - * @var \Symfony\Bundle\AsseticBundle\Twig\AsseticNode - */ - $resultNode = $this->parser->parse($startToken); - - $this->assertEquals(31, $resultNode->getLine()); - $this->assertEquals('oro_css', $resultNode->getNodeTag()); - } - - public function testParseBrokenStream() - { - $parser = $this->getMockBuilder('Twig_Parser') - ->disableOriginalConstructor() - ->getMock(); - - $brokenStream = new Twig_TokenStream( - [ - new Twig_Token(Twig_Token::NAME_TYPE, 'bad', 31), - new Twig_Token(Twig_Token::OPERATOR_TYPE, '=', 31), - new Twig_Token(Twig_Token::STRING_TYPE, 'bad value', 31), - ] - ); - - $parser->expects($this->once()) - ->method('getStream') - ->will($this->returnValue($brokenStream)); - - $this->parser->setParser($parser); - - $this->setExpectedException('Twig_Error_Syntax'); - - $this->parser->parse(new Twig_Token(Twig_Token::NAME_TYPE, 'oro_css', 31)); - } -} diff --git a/src/Oro/Bundle/AsseticBundle/Tests/Unit/Twig/AsseticExtensionTest.php b/src/Oro/Bundle/AsseticBundle/Tests/Unit/Twig/AsseticExtensionTest.php deleted file mode 100644 index 543fc0adf9be..000000000000 --- a/src/Oro/Bundle/AsseticBundle/Tests/Unit/Twig/AsseticExtensionTest.php +++ /dev/null @@ -1,63 +0,0 @@ -assetsFactory = $this->getMockBuilder('Symfony\Bundle\AsseticBundle\Factory\AssetFactory') - ->disableOriginalConstructor() - ->getMock(); - - $this->templateNameParser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface') - ->disableOriginalConstructor() - ->getMock(); - - $this->assets = [ - 'css' => [ - 'first.css', - 'second.css' - ] - ]; - - $this->enabledBundles = ['testBundle']; - - $this->extension = new AsseticExtension( - $this->assetsFactory, - $this->assets, - $this->templateNameParser, - $this->enabledBundles - ); - } - - public function testGetTokenParsers() - { - $tokens = $this->extension->getTokenParsers(); - $this->assertTrue(is_array($tokens)); - $token = $tokens[0]; - $this->assertEquals('oro_css', $token->getTag()); - } - - public function testGetName() - { - $this->assertEquals('oro_assetic', $this->extension->getName()); - } - - public function testGetNodeVisitors() - { - $asseticNodeVisitors = $this->extension->getNodeVisitors(); - $this->assertTrue(is_array($asseticNodeVisitors)); - } -} diff --git a/src/Oro/Bundle/AsseticBundle/Twig/AsseticExtension.php b/src/Oro/Bundle/AsseticBundle/Twig/AsseticExtension.php deleted file mode 100644 index 4ea3a7d38fb6..000000000000 --- a/src/Oro/Bundle/AsseticBundle/Twig/AsseticExtension.php +++ /dev/null @@ -1,69 +0,0 @@ -enabledBundles = $enabledBundles; - $this->templateNameParser = $templateNameParser; - $this->assetsFactory = $assetsFactory; - $this->assets = $assets; - } - - /** - * {@inheritDoc} - */ - public function getTokenParsers() - { - return [ - new AsseticTokenParser($this->assets['css'], $this->assetsFactory, 'oro_css', 'css/*.css'), - ]; - } - - /** - * {@inheritDoc} - */ - public function getNodeVisitors() - { - return [ - new AsseticNodeVisitor($this->templateNameParser, $this->enabledBundles), - ]; - } -} diff --git a/src/Oro/Bundle/AsseticBundle/composer.json b/src/Oro/Bundle/AsseticBundle/composer.json deleted file mode 100644 index 14b7b13b41fe..000000000000 --- a/src/Oro/Bundle/AsseticBundle/composer.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "oro/assetic-bundle", - "type": "symfony-bundle", - "description": "BAP Assetic Bundle", - "keywords": ["BAP"], - "homepage": "https://github.com/laboro/AsseticBundle", - "license": "MIT", - "require": { - "php": ">=5.3.3", - "symfony/symfony": "2.1.*", - "kriswallsmith/assetic": "1.1.*@dev" - }, - "autoload": { - "psr-0": { "Oro\\Bundle\\AsseticBundle": "" } - }, - "target-dir": "Oro/Bundle/AsseticBundle", - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - } -} \ No newline at end of file diff --git a/src/Oro/Bundle/PimDataGridBundle/Resources/config/assets.yml b/src/Oro/Bundle/PimDataGridBundle/Resources/config/assets.yml deleted file mode 100644 index 3a7441e21f56..000000000000 --- a/src/Oro/Bundle/PimDataGridBundle/Resources/config/assets.yml +++ /dev/null @@ -1,4 +0,0 @@ -css: - grids: - - bundles/pimdatagrid/lib/multiselect/jquery.multiselect.css - - bundles/pimdatagrid/lib/multiselect/jquery.multiselect.filter.css diff --git a/src/Oro/Bundle/PimDataGridBundle/Resources/public/less/index.less b/src/Oro/Bundle/PimDataGridBundle/Resources/public/less/index.less new file mode 100644 index 000000000000..71b69a08d178 --- /dev/null +++ b/src/Oro/Bundle/PimDataGridBundle/Resources/public/less/index.less @@ -0,0 +1,2 @@ +@import (less) "./web/bundles/pimdatagrid/lib/multiselect/jquery.multiselect.css"; +@import (less) "./web/bundles/pimdatagrid/lib/multiselect/jquery.multiselect.filter.css"; diff --git a/tests/front/WRITING-FRONT-TESTS.md b/tests/front/WRITING-FRONT-TESTS.md index b37a2481aef7..940cb27b784d 100644 --- a/tests/front/WRITING-FRONT-TESTS.md +++ b/tests/front/WRITING-FRONT-TESTS.md @@ -27,7 +27,7 @@ There are three commands that can be run: > Note: If you want to run inspect or add breakpoints in the acceptance tests or step definitions you can follow these steps: - Add a breakpoint somewhere in your step definition with `debugger;` - - Run `node --inspect-brk node_modules/.bin/cucumber-js --tags @acceptance-front -r ./webpack/test/acceptance/run-steps.js -r ./tests/front/acceptance/cucumber ./tests/features/` + - Run `node --inspect-brk node_modules/.bin/cucumber-js --tags @acceptance-front -r ./frontend/test/acceptance/run-steps.js -r ./tests/front/acceptance/cucumber ./tests/features/` - Go to `chrome://inspect` in Chrome and click on the target `node_modules/.bin/cucumber-js`. If you don't see it, you can click on `Open dedicated DevTools for Node` instead. An inspector window will open. - Go to the sources tab in the inspector and click the play icon, you should now be able to walk through the steps diff --git a/tests/front/unit/jest/unit.jest.js b/tests/front/unit/jest/unit.jest.js index 0fbf751da6ca..bb329db19b68 100644 --- a/tests/front/unit/jest/unit.jest.js +++ b/tests/front/unit/jest/unit.jest.js @@ -7,7 +7,7 @@ const unitConfig = { '^.+\\.tsx?$': 'ts-jest', }, moduleNameMapper: { - '^require-context$': `${__dirname}/../../../../webpack/require-context.js`, + '^require-context$': `${__dirname}/../../../../frontend/webpack/require-context.js`, '^module-registry$': `${__dirname}/../../../../web/js/module-registry.js`, }, testRegex: '(tests/front/unit)(.*)(unit).(jsx?|tsx?)$', diff --git a/webpack.config.js b/webpack.config.js index 88c1ebc11869..ea0c28a5b082 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -19,7 +19,7 @@ if (!fs.existsSync(sourcePath)) { running webpack \n`); } -const {getModulePaths, createModuleRegistry} = require('./webpack/requirejs-utils'); +const {getModulePaths, createModuleRegistry} = require('./frontend/webpack/requirejs-utils'); const {aliases, config} = getModulePaths(rootDir, __dirname, sourcePath); createModuleRegistry(Object.keys(aliases), rootDir); @@ -72,7 +72,7 @@ const webpackConfig = { exclude: /\/node_modules\/|\/spec\//, use: [ { - loader: path.resolve(__dirname, 'webpack/config-loader'), + loader: path.resolve(__dirname, 'frontend/webpack/config-loader'), options: { configMap: config, }, @@ -141,7 +141,7 @@ const webpackConfig = { // Expose the require-polyfill to window { - test: path.resolve(__dirname, './webpack/require-polyfill.js'), + test: path.resolve(__dirname, './frontend/webpack/require-polyfill.js'), use: [ { loader: 'expose-loader', @@ -176,7 +176,7 @@ const webpackConfig = { }, }, { - loader: path.resolve(__dirname, 'webpack/config-loader'), + loader: path.resolve(__dirname, 'frontend/webpack/config-loader'), options: { configMap: config, }, diff --git a/yarn.lock b/yarn.lock index 1e813ffea08e..e9b98099db23 100644 --- a/yarn.lock +++ b/yarn.lock @@ -333,6 +333,11 @@ arrify@^1.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= +asap@~2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= + asn1.js@^4.0.0: version "4.10.1" resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0" @@ -1307,6 +1312,11 @@ binary-extensions@^1.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.12.0.tgz#c2d780f53d45bba8317a8902d4ceeaf3a6385b14" integrity sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg== +bluebird@3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9" + integrity sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA== + bluebird@^3.4.1, bluebird@^3.4.7, bluebird@^3.5.1: version "3.5.3" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" @@ -1633,23 +1643,17 @@ cheerio@^1.0.0-rc.2: lodash "^4.15.0" parse5 "^3.0.1" -chokidar@^1.6.0, chokidar@^1.6.1: - version "1.7.0" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" - integrity sha1-eY5ol3gVHIB2tLNg5e3SjNortGg= +chokidar-cli@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/chokidar-cli/-/chokidar-cli-1.2.1.tgz#50574a63414174c5ac62f495abe09ae3cb6cb8b5" + integrity sha512-JIrV9Z/pT7KjBWp9u+Uba0utdl2rmNaTj6t4ucaFseYDQASHZnWXy6vJIufDX+4FVh081gQZ2odrqorMfQhn7w== dependencies: - anymatch "^1.3.0" - async-each "^1.0.0" - glob-parent "^2.0.0" - inherits "^2.0.1" - is-binary-path "^1.0.0" - is-glob "^2.0.0" - path-is-absolute "^1.0.0" - readdirp "^2.0.0" - optionalDependencies: - fsevents "^1.0.0" + bluebird "3.5.1" + chokidar "2.0.4" + lodash "4.17.10" + yargs "12.0.1" -chokidar@^2.0.2: +chokidar@2.0.4, chokidar@^2.0.2: version "2.0.4" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.4.tgz#356ff4e2b0e8e43e322d18a372460bbcf3accd26" integrity sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ== @@ -1669,6 +1673,22 @@ chokidar@^2.0.2: optionalDependencies: fsevents "^1.2.2" +chokidar@^1.6.0, chokidar@^1.6.1: + version "1.7.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" + integrity sha1-eY5ol3gVHIB2tLNg5e3SjNortGg= + dependencies: + anymatch "^1.3.0" + async-each "^1.0.0" + glob-parent "^2.0.0" + inherits "^2.0.1" + is-binary-path "^1.0.0" + is-glob "^2.0.0" + path-is-absolute "^1.0.0" + readdirp "^2.0.0" + optionalDependencies: + fsevents "^1.0.0" + chownr@^1.0.1, chownr@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.1.tgz#54726b8b8fff4df053c42187e801fb4412df1494" @@ -1755,6 +1775,11 @@ cliui@^4.0.0: strip-ansi "^4.0.0" wrap-ansi "^2.0.0" +clone@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" + integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18= + co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -2125,6 +2150,13 @@ decamelize@^1.0.0, decamelize@^1.1.1: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= +decamelize@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-2.0.0.tgz#656d7bbc8094c4c788ea53c5840908c9c7d063c7" + integrity sha512-Ikpp5scV3MSYxY39ymh45ZLEecsTdv/Xj2CaQfI8RLMuwi7XvjX9H/fhraiSuU+C5w5NTDu4ZU72xNiZnurBPg== + dependencies: + xregexp "4.0.0" + decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" @@ -2451,7 +2483,7 @@ enzyme@^3.3.0: rst-selector-parser "^2.2.3" string.prototype.trim "^1.1.2" -errno@^0.1.3, errno@~0.1.7: +errno@^0.1.1, errno@^0.1.3, errno@~0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" integrity sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg== @@ -2984,6 +3016,13 @@ find-up@^2.0.0, find-up@^2.1.0: dependencies: locate-path "^2.0.0" +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== + dependencies: + locate-path "^3.0.0" + find@^0.2.7: version "0.2.9" resolved "https://registry.yarnpkg.com/find/-/find-0.2.9.tgz#4b73f1ff9e56ad91b76e716407fe5ffe6554bb8c" @@ -3488,6 +3527,11 @@ ignore@^3.3.3: resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== +image-size@~0.5.0: + version "0.5.5" + resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c" + integrity sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w= + import-local@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-1.0.0.tgz#5e4ffdc03f4fe6c009c6729beb29631c2f8227bc" @@ -4430,6 +4474,22 @@ left-pad@^1.3.0: resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== +less@^3.9.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/less/-/less-3.9.0.tgz#b7511c43f37cf57dc87dffd9883ec121289b1474" + integrity sha512-31CmtPEZraNUtuUREYjSqRkeETFdyEHSEPAGq4erDlUXtda7pzNmctdljdIagSb589d/qXGWiiP31R5JVf+v0w== + dependencies: + clone "^2.1.2" + optionalDependencies: + errno "^0.1.1" + graceful-fs "^4.1.2" + image-size "~0.5.0" + mime "^1.4.1" + mkdirp "^0.5.0" + promise "^7.1.1" + request "^2.83.0" + source-map "~0.6.0" + leven@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" @@ -4510,6 +4570,14 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + lodash.assign@^4.1.0, lodash.assign@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" @@ -4555,6 +4623,11 @@ lodash.union@4.6.0: resolved "https://registry.yarnpkg.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88" integrity sha1-SLtQiECfFvGCFmZkHETdGqrjzYg= +lodash@4.17.10: + version "4.17.10" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" + integrity sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg== + lodash@4.17.4: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -4720,7 +4793,7 @@ mime-types@^2.1.12, mime-types@~2.1.19: dependencies: mime-db "~1.37.0" -mime@^1.3.4: +mime@^1.3.4, mime@^1.4.1: version "1.6.0" resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== @@ -5260,6 +5333,13 @@ p-limit@^1.1.0: dependencies: p-try "^1.0.0" +p-limit@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.1.0.tgz#1d5a0d20fb12707c758a655f6bbc4386b5930d68" + integrity sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g== + dependencies: + p-try "^2.0.0" + p-locate@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" @@ -5267,11 +5347,23 @@ p-locate@^2.0.0: dependencies: p-limit "^1.1.0" +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== + dependencies: + p-limit "^2.0.0" + p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= +p-try@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" + integrity sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ== + pad-right@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/pad-right/-/pad-right-0.2.2.tgz#6fbc924045d244f2a2a244503060d3bfc6009774" @@ -5525,6 +5617,13 @@ promise-inflight@^1.0.1: resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM= +promise@^7.1.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" + integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== + dependencies: + asap "~2.0.3" + prop-types@^15.6.2: version "15.6.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102" @@ -5941,7 +6040,7 @@ request-promise-native@^1.0.5: stealthy-require "^1.1.0" tough-cookie ">=2.3.3" -request@^2.87.0: +request@^2.83.0, request@^2.87.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== @@ -7348,6 +7447,11 @@ xml@0.0.12: resolved "https://registry.yarnpkg.com/xml/-/xml-0.0.12.tgz#f08b347109912be00285785f46f15ad8e50a5f67" integrity sha1-8Is0cQmRK+AChXhfRvFa2OUKX2c= +xregexp@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-4.0.0.tgz#e698189de49dd2a18cc5687b05e17c8e43943020" + integrity sha512-PHyM+sQouu7xspQQwELlGwwd05mXUFqwFYfqPO0cC7x4fxyHnnuetmQr6CjJiafIDoH4MogHb9dOoJzR/Y4rFg== + xtend@^4.0.0, xtend@~4.0.0, xtend@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" @@ -7358,7 +7462,7 @@ y18n@^3.2.1: resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= -y18n@^4.0.0: +"y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== @@ -7381,6 +7485,13 @@ yamljs@0.3.0: argparse "^1.0.7" glob "^7.0.5" +yargs-parser@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" + integrity sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ== + dependencies: + camelcase "^4.1.0" + yargs-parser@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-3.2.0.tgz#5081355d19d9d0c8c5d81ada908cb4e6d186664f" @@ -7417,6 +7528,24 @@ yargs-parser@^9.0.2: dependencies: camelcase "^4.1.0" +yargs@12.0.1: + version "12.0.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.1.tgz#6432e56123bb4e7c3562115401e98374060261c2" + integrity sha512-B0vRAp1hRX4jgIOWFtjfNjd9OA9RWYZ6tqGA9/I/IrTMsxmKvtWy+ersM+jzpQqbC3YfLzeABPdeTgcJ9eu1qQ== + dependencies: + cliui "^4.0.0" + decamelize "^2.0.0" + find-up "^3.0.0" + get-caller-file "^1.0.1" + os-locale "^2.0.0" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^2.0.0" + which-module "^2.0.0" + y18n "^3.2.1 || ^4.0.0" + yargs-parser "^10.1.0" + yargs@^10.0.3: version "10.1.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-10.1.2.tgz#454d074c2b16a51a43e2fb7807e4f9de69ccb5c5"